IMD SolutionComputing LibraryShop main store

Troubleshooting

Why an Ignition Easy Chart loads slowly on 15-day history

Edge computing and IIoT Published 8 min read

Short answer

A five-minute chart for six tags over 15 days is almost never server load. Confirm whether the pens read Tag Historian tables or transaction-group tables, capture the slow statement in a bounded PostgreSQL logging window, and read its EXPLAIN plan. Tag Historian tables ship with timestamp indexes; transaction-group tables need one you add, and postgresql.conf comes last.

On this page
  1. Read the symptom before changing anything
  2. Confirm which storage path feeds the pens
  3. Capture the slow statement in a bounded window
  4. Read the EXPLAIN plan before touching postgresql.conf
  5. What the missing index costs: a worked example
  6. The decision for each case
  7. Prove the fix end to end
  8. Questions asked

A five-minute Easy Chart for six tags over 15 days of Ignition tag history is a query-plan fault, not a sign of server load. In one reported Ignition 7.9 case on a Ubuntu Server 16.04 LTS host with 32 GB of RAM and about 100,000 tags, the chart took about five minutes and sometimes turned red as the database connection dropped, while the database posted only 150 to 250 queries per second — a throughput count that says nothing about the cost of one statement. The working sequence: confirm whether the chart's pens read Tag Historian tables or transaction-group tables, capture the slow statement in a bounded PostgreSQL logging window, read its EXPLAIN plan, and fix the timestamp index the plan is missing. Adjust postgresql.conf only after the plan is clean.

Read the symptom before changing anything #

The chart shows two symptoms and they split into separate checks. Slow means the request finished, after too long. Red means the request failed: the connection dropped or the request ran past a limit, and a red chart that was already loading slowly usually means one long query tripped that limit, not a second fault. Correlate the Ignition wrapper log with the PostgreSQL log at the exact minute of a red chart before you treat them as two problems.

What you observe What it tells you
Chart loads after about five minutes One expensive statement: go to the query plan
Chart turns red mid-load Connection drop or an exceeded limit: correlate both logs at that minute
150 to 250 queries per second on the server Activity level only; it carries nothing about the chart statement's cost

The queries-per-second figure needs its own caution: a database can serve hundreds of cheap statements each second while one chart query scans a table for minutes. That number is not evidence of load and not evidence of health, so do not size a new server from it.

Red is also not blank. A chart that comes back with no rows at all points at stored data quality rather than query time, and that failure has a separate cause chain, covered in Why a slow tag blanks the Easy Chart after bad quality.

Confirm which storage path feeds the pens #

Two storage paths feed an Ignition Easy Chart and they fail differently. Ignition's Tag Historian creates and maintains timestamp indexes on its own storage tables, so there the first suspect is a plan that ignores the existing index, not a missing one. Transaction groups write ordinary database tables that get no timestamp index automatically, so a chart bound to transaction-group history is the classic missing-index case, and adding a duplicate index to Tag Historian tables instead would only add write overhead without touching the fault. The two paths are set side by side in Ignition tag historian versus transaction groups.

Do not infer the path from a tag name or from the chart's appearance. Open the chart's pen configuration, note each tag path, and trace which provider writes each one. To confirm a tag is still receiving values at all, right-click the tag in the Tag Browser and select Diagnostics > Tag History, then read Last Update; a tag that stopped recording is a different fault from a tag whose recorded history loads slowly.

Capture the slow statement in a bounded window #

You cannot fix a plan you have not seen, so capture the statement the chart actually runs.

  1. Record the request time, the selected pen tag paths, and the 15-day range.
  2. Set log_min_duration_statement in postgresql.conf to 5000 — the unit is milliseconds, so this catches statements over five seconds — and reload the configuration; no restart is needed.
  3. Reproduce one slow chart request and let it finish.
  4. Find the matching statement in the PostgreSQL log by its timestamp and by the history tables it names, and keep the full text with its parameters and time predicates.
  5. Restore the previous logging value in the same session.

Keep the window to one reproduction. Statement logging writes every qualifying query to the log and adds I/O to the very server you are trying to relieve, so run the reproduction when the historian is not feeding live clients, and turn the setting back as soon as one request is captured. A plan is only evidence when it belongs to the slow request: the same query over a different range or tag set can take a different access path.

Read the EXPLAIN plan before touching postgresql.conf #

Run EXPLAIN on the captured statement with its real literal values substituted, because the plan depends on them. Two node names answer the whole question: Seq Scan over the history table means the time filter is reading every row, and Index Scan on the timestamp column means the filter is using an index. If the plan already shows an index scan, stop tuning indexes — the remaining cost is row count, not access path.

When an index exists and the plan still picks a sequential scan, three causes cover most cases. Stale planner statistics make a large table look small, so run ANALYZE on the history tables and plan again. A timestamp column wrapped in a function or cast defeats a plain index unless a matching expression index exists, so check how the captured statement writes its time predicate. A badly bloated index can cost more than the scan it should prevent, so measure before rebuilding.

postgresql.conf comes last. Its memory settings decide how fast rows are processed, not how many are read, and a sequential scan stays a sequential scan regardless of allocation. The reported 32 GB is the server's RAM, not a value to copy into any setting, and switching database engines does not remove a full scan either: an unindexed timestamp filter costs the same work on any backend. If you do tune, change one setting at a time from a saved copy of the current file so you can roll back.

What the missing index costs: a worked example #

Every input here is an example; your tag count and logging rate set your own numbers. Assume 2,000 tags actually store values at one stored value per tag per minute — 60 × 24 = 1,440 rows per tag per day — and the table holds two years, 730 days, of history.

Quantity Arithmetic Result
Rows in the 15-day chart window 2,000 × 1,440 × 15 43,200,000 rows
Rows in the whole table 2,000 × 1,440 × 730 2,102,400,000 rows
Share of the table the chart needs 43,200,000 ÷ 2,102,400,000 about 2%

A sequential scan visits all 2,102,400,000 rows to return the 43,200,000 the chart needs. At an illustrative sustained rate of 7,000,000 rows per second — a busy server on ordinary storage — the scan spends 2,102,400,000 ÷ 7,000,000 = 300 s, which is the reported five minutes. The rate moves the total inversely: sustain twice the rate and the scan takes 150 s; sustain half of it and the scan takes 600 s. With the timestamp index in use, the same rate covers the 43,200,000-row window in 43,200,000 ÷ 7,000,000 = 6 s, so the index turns a full scan into a six-second read. Rows you no longer chart still sit in the table and inflate every scan, but pruning is its own job, laid out in Cut Ignition Tag Historian growth before compressing the table.

The decision for each case #

Commit to one of these outcomes before you close the job:

  • Pens read Tag Historian tables and the plan shows Seq Scan: the built-in index is being bypassed. Run ANALYZE on the history tables, check the captured statement for a function or cast wrapped around the timestamp column, and measure index bloat. Do not add a second timestamp index to tables that already carry one.
  • Pens read transaction-group tables and the plan shows Seq Scan: create the missing index on the timestamp column. The build itself takes time and I/O on a large table, so build it in a quiet window, then run EXPLAIN again and expect Index Scan on that column.
  • The plan shows Index Scan and the chart still takes minutes: the access path is right and the row count is the cost. Return fewer rows — have the request aggregate on retrieval or cap its row count — or split the 15-day view into shorter pages; Diagnose slow historian trends by separating events from samples walks the trend side of that split.
  • The query now returns in seconds but the chart still turns red: the remaining fault is the connection or its limit, not the plan. Correlate the Ignition and PostgreSQL logs at the drop time and fix that on its own.

Prove the fix end to end #

Repeat the exact request you captured: same chart, same pens, same window. Run it three times so a warm cache cannot masquerade as the fix, and record the plan node on each run — Index Scan on the timestamp column, not just a faster wall clock. Check both failure modes separately every time: a chart that still turns red is not fixed, and a chart that stays connected but takes minutes is not fixed either. Close the job when the request returns in seconds — the worked example's indexed read is 6 s — with no connection errors in either log during the test, and record which storage path you tested and which change produced the result.

Questions asked

Is 150 to 250 queries per second evidence that the database is overloaded?

No. Queries per second counts statements, not their cost, so a server can post a high rate while one chart query scans a table for minutes. While the chart loads, watch the server's own view of currently running statements and their durations, then judge load from the plan and duration of the chart's statement rather than from the statement count.

Should I tune the PostgreSQL memory settings first, since the server has spare RAM?

No. Memory settings change how fast rows are processed, not how many are read, and some of them also shift the planner's cost estimates, so tuning first can hide the fault you are chasing. Fix the access path, plan again, and only then adjust one setting at a time with the previous postgresql.conf kept for rollback.

Is EXPLAIN ANALYZE safe to run against a live historian?

Plain EXPLAIN only plans the statement and reads no rows, so it is safe anywhere. EXPLAIN ANALYZE actually executes the statement, so on a live historian it repeats the five-minute load you are diagnosing. Run it against a restored copy of the database first, or in a quiet window on production, and take the plain plan before you decide to analyze.

How long can the query-logging window stay on?

One reproduction is enough. The setting writes every statement over its threshold to the server log, and on a busy historian that log grows quickly while adding I/O to the very server you are trying to relieve. Note the original value, capture one slow request, and set the original value back in the same session.

Would moving the historian to a different database engine fix the slow chart?

Not this symptom. A timestamp filter without a usable index forces a full table scan on any engine, so a migration carries the same scan to a new system. Fix the index and the plan first, and choose an engine for site standards, existing skills or vendor support reasons rather than to escape a missing index.

Keep reading

  • How-to

    How to log Ignition tags every 15 minutes to a database

    To capture Ignition tag values on a strict 15-minute schedule, use a scheduled SQL Bridge transaction group that inserts a snapshot row into a database table, then point the report's query at that table. The tag historian is deadband-driven and stores asynchronously, so it cannot be set to one fixed 15-minute timestamp.

    Edge computing and IIoT

  • Troubleshooting

    Why a slow tag blanks the Easy Chart after bad quality

    The pen is empty because the historian stopped writing, not because of a quality fault: after the tag recovered, its slow value settled back inside the Analog deadband corridor, so the last Good row aged out of the chart range. Set Max Time Between Samples to at most half of the smallest span users can select, and every window keeps a usable row.

    Edge computing and IIoT

  • Troubleshooting

    Citect Historian 2016 slow retrieval as SQL tables grow

    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.

    Edge computing and IIoT