IMD SolutionComputing LibraryShop main store

Troubleshooting

Citect Historian 2016 slow retrieval as SQL tables grow

Edge computing and IIoT Published 6 min read

Short answer

Retrieval slow in both the Citect Historian Excel tool and a direct SQL query is a response-time problem in the SQL history tables, which grow with every historized row. Lower over-fast storage rates, purge to your retention, reindex, and start the migration to AVEVA Historian, since end of support for Citect Historian has been announced.

On this page
  1. Separate latency from response time first
  2. Establish whether the new tags caused it or exposed it
  3. Find the bottleneck on the host
  4. Row math for one tag at a 1-second rate against 90-day retention
  5. Purge and reindex, in that order
  6. Purge is the stopgap, migration is the fix
  7. Confirm the fix and measure the regrowth
  8. Questions asked

Slow retrieval that shows up in both the Citect Historian Excel tool and a query run directly against the SQL database is a database problem, not an Excel add-in or a Citect SCADA data-source problem. Citect Historian is a SQL database application: every historized row lands in SQL history tables, so query cost rises with table size, and the maintenance schedule you already ran is routine care, not a size remedy. No Historian-side procedure runs after a tag change that would restore speed. Lower the storage rate of tags stored faster than the process needs, purge history to your retention, and reindex; start the migration to AVEVA Historian in parallel, because AVEVA has announced formal end of support for Citect Historian.

Separate latency from response time first #

Two different faults make historian data arrive late, and they have different fixes. Time a query that returns a handful of rows, and compare that duration with the age of the newest stored value.

  • Latency: the newest value is always several minutes old, but the query itself returns quickly. Look at the data-source connection, a storage backlog, or resource starvation during storage. If the tags sit behind a shared serial link, note that Modbus RTU drive polling on one serial port is slow for reasons of its own.
  • Response time: a query returning a few rows takes minutes to complete. Look at table size, index fragmentation, and disk or memory limits on the SQL host.

Your case is decided already, because the same slowness reproduces in a direct SQL query: treat it as response time. The other shape of this fault, where the Excel tool is slow but direct SQL stays fast, is the case covered in historian reads slow in Excel after adding tags. What sets historian data retrieval speed when table size is not the limit is a separate question, covered in historian data retrieval speed: what actually decides it.

Establish whether the new tags caused it or exposed it #

The slowdown started after historized trend tags were added from Citect SCADA. Query one old tag and one new tag over the same time span and compare the durations.

  • Only the new tags are slow: the tags themselves are the load. Get each tag's real data change rate and history depth, because a tag stored at a 1-second rate writes and returns 60 times the rows per hour of a tag stored at a 1-minute rate.
  • Old and new tags are both slow: the database was already large, and the new tags pushed it past its limit. The remedy is the purge-and-reindex path below.

Either way the lever is the same: rows held in the history tables.

Find the bottleneck on the host #

Run Perfmon or Task Manager on the SQL host and record CPU, memory and disk twice: once with storage running and nobody querying, once with storage running while the slow query pulls the new tags. Read the two captures against this table.

Observation Likely limit Action
Disk queue or read latency high while the query runs Disk I/O from large scans Purge rows, move to faster storage
Memory near full with heavy paging Memory Add RAM, or cut the working set by purging
CPU pinned while the query runs Query cost, fragmented indexes Reindex, then re-measure
Storage alone saturates a resource Ingest rate too high Lower the storage rate of high-rate tags

If storage by itself loads the host heavily, queries have no headroom: lower the storage rates before touching anything else.

Row math for one tag at a 1-second rate against 90-day retention #

Inputs: a typical high-rate trend tag stored at 1 sample per second; a comparison tag at 1 sample per minute; and an online retention the plant sets at 90 days.

Rule in words: rows per day equal samples per hour times 24, and rows held equal rows per day times the retention in days.

Arithmetic:

  • At 1 sample per second: 3,600 samples/h x 24 h/day = 86,400 rows/day. Over 90 days: 86,400 rows/day x 90 days = 7,776,000 rows.
  • At 1 sample per minute: 60 samples/h x 24 h/day = 1,440 rows/day. Over 90 days: 1,440 rows/day x 90 days = 129,600 rows.
  • Ratio: 7,776,000 / 129,600 = 60.
  • Rows avoided by the rate cut: 7,776,000 - 129,600 = 7,646,400, which is 59 of every 60 rows.

Decision: where the process tolerates 1-minute resolution, cut the rate before purging, because that removes 98.3 percent of the tag's rows with one configuration change. Where it does not, the purge has to hold the line on its own. Treat any tag holding millions of rows inside the span people query as a rate-cut and purge candidate.

Purge and reindex, in that order #

  1. Baseline the fault: time one small query on an old tag and one on a new tag, and note the age of the newest stored value for each.
  2. Record CPU, memory and disk twice: storage only, and storage plus the slow query.
  3. List every slow tag's real storage rate, and lower in the historized trend configuration on the Citect SCADA side any rate faster than the process needs.
  4. Back up the database before anything is deleted: the purge removes rows, and this backup is the only rollback.
  5. Archive or export the rows older than your retention that you must keep.
  6. Purge the history tables back to that retention, using the deletion method your Citect Historian installation supports.
  7. Reindex the history tables after the purge, so the indexes match the reduced row count.
  8. Repeat steps 1 and 2 under the same conditions and compare.

Purge is the stopgap, migration is the fix #

Criterion Purge and reindex Citect Historian Migrate to AVEVA Historian
Effect on the size-driven slowdown Reindexing helps; removing rows is the only real remedy Removes the limit: history goes to external time-series files
Where the data sits SQL history tables SQL Server holds relatively static configuration data only
Time to apply Hours to days A project
Older history Lost unless archived before the purge Not limited by table growth
Support status End of support announced Current product

Run both in sequence: purge and reindex now to get retrieval back to usable, and start the migration in parallel. In the US, AVEVA has run a sales program to swap Citect Historian for AVEVA Historian; ask AVEVA sales whether it still runs before you budget the migration, and confirm the current Citect Historian support dates with AVEVA at the same time. If the design needs redundant connections after the move, settle AVEVA Historian connector redundancy options during planning rather than after cutover.

Confirm the fix and measure the regrowth #

Repeat the two timed queries through both the Excel tool and direct SQL, and compare against the baseline. Check the host again with storage and a query active: disk, memory and CPU should show headroom beyond the storage-only capture. Then keep timing the same query at regular intervals as the tables regrow. Regrowth follows the storage rate, so the slope of that duration is the countdown to the migration's deadline.

Questions asked

Is there a Citect Historian procedure we missed after modifying historized tags?

No. Retrieval speed after a tag change is a database size question, and no Historian-side rebuild step exists that restores it. The maintenance schedule you already ran is routine database care; if it changed nothing, the remaining levers are the tags' storage rates, the number of rows held online, and the state of the indexes. A tag modification leaves no follow-up procedure pending on the Historian side.

How long does a purge and reindex hold before retrieval slows again?

Regrowth follows the storage rate. One tag at one sample per second adds 86,400 rows a day, so a purge to 90 days is back to its old size in 90 days at that rate. Time the same query weekly after the purge; the slope of that duration gives you the date the migration has to be finished by. Dropping the rate to one sample per minute stretches the same budget sixty-fold.

Will faster storage or more RAM on the SQL host fix it?

They help at the margin but do not remove the cause. The slowdown is driven by the number of rows the history tables hold, and hardware only buys headroom against that row count, which keeps growing at the storage rate. Use the host captures to decide: if the disk queue or read latency is the limit, faster storage improves the same scans; if memory is near full with paging, more RAM helps. Purge, reindex and cut over-fast storage rates first, because they attack the row count, and treat hardware as a stopgap alongside the purge while the migration is planned.

What happens to retrieval speed after migrating to AVEVA Historian?

The size limit goes away because detailed history is written to external time-series files and SQL Server holds only relatively static configuration data. The row-count arithmetic that governs Citect Historian no longer applies to queries, so retrieval stops being a function of how many rows the history tables hold. Confirm with AVEVA how existing Citect history is carried across before you schedule the cutover.

Should this case go to AVEVA Technical Support?

Yes, once you have the evidence in hand. Open the case with the timed queries, the host resource captures taken with and without the query running, and the row counts or storage rates of the slow tags, because that package lets support confirm the size diagnosis instead of re-deriving it. Also use the case to confirm the current Citect Historian end-of-support dates and to ask how existing history is migrated to AVEVA Historian. The purge and reindex you can do yourself; the support dates and migration path are the questions worth a ticket.

Keep reading

  • Troubleshooting

    Edge trend shows no historian data: fix the doubled SELECT

    The trend stays blank because a complete SELECT statement was pasted into the Table field, so the gateway wraps it in its own SELECT ... FROM and SQL Server rejects the result as incorrect syntax near the keyword select. Put only Runtime.dbo.History in Table, carry DateTime, TagName and Value in the column controls, and move TagName = 'SysTimeSec' into the filter control.

    Edge computing and IIoT

  • Troubleshooting

    Fix Citect Historian 2016 CTAPI data source connection error

    First confirm the machine running the SCADA 2016 runtime is the one Historian sits on, because 127.0.0.1 is loopback. Then set [CTAPI]Remote=1 and [CTAPI]AllowLegacyConnections=0 in that runtime's citect.ini, restart, and retry the data source: Historian 2016's V7.50 CTAPI client needs only Remote=1.

    Edge computing and IIoT

  • Explainer

    Historian data retrieval speed: what actually decides it

    An indexed historian returns a year-old sample about as fast as yesterday's, so data age is the wrong variable to optimize. Retrieval speed is set by the requested window, returned point count, retrieval mode, archive storage tier and client rendering. Benchmark candidates with identical query semantics before choosing one.

    Edge computing and IIoT