Troubleshooting
Why an Ignition historian string tag stores duplicate rows
Short answer
On Change in the Ignition tag historian fires on quality changes as well as value changes. When quality leaves 192 Good and returns inside the minimum time between samples, the intermediate transition is dropped and the next eligible write stores a row that looks like a duplicate. Set minimum time to 0 on one test tag and compare the value and dataintegrity columns to confirm.
On this page
- Why does an On Change tag log the same string twice?
- Why does the 10 second minimum time hide the real change?
- What does the table view show versus what happened at the tag?
- How do I separate a tag fault from a historian setting?
- How do I capture the transition that caused the row?
- What should the table show once it is fixed?
- Questions asked
An Ignition string tag in On Change sample mode that writes identical values to PostgreSQL is almost always responding to a quality transition, not a value change. The tag historian compares more than the string: when the tag quality leaves 192 (Good) and returns, each transition is a change event. With a 10 second minimum time between samples, the first transition is discarded, and the write that finally lands looks like a duplicate.
Why does an On Change tag log the same string twice? #
On Change fires on any change the historian sees, and quality is part of that comparison. A quality code of 192 means Good; if the tag drops to another code and recovers, each transition triggers a historical write even though the string value never moved. The row that lands in PostgreSQL can carry the same text with a different value in the dataintegrity column, or a timestamp that does not match the moment the quality actually changed.
The comparison applies to the value too. A string that flips and reverts is two change events, so the reverted value writes again even though it equals the row before it. This is documented behavior of the tag historian system: a change in value or quality drives the write decision, not a change in the visible text alone.
Why does the 10 second minimum time hide the real change? #
The minimum time between samples defers or discards writes that arrive inside its window, so the event that caused the row is not the event stored in it. Walk through a 10 second window on a flapping tag:
- At time T the tag writes; the row shows the string with quality 192.
- Within the next 10 seconds the quality leaves 192. The change event arrives before the minimum time has elapsed, so it is discarded, not buffered.
- After the window expires, the quality returns to 192 or changes again. This transition is now eligible, so it writes.
- The stored row shows the same string as the row at T, and the discarded quality drop that caused it never appears in the table.
The result is a repeat that no query of the value column alone can explain. The same mechanism applies to a value that changes and reverts inside the window.
What does the table view show versus what happened at the tag? #
The value column alone cannot distinguish a quality write from a value write; the dataintegrity column and the timestamp spacing can. Compare what you observe against the likely cause:
| Observation | Likely cause | Where to check |
|---|---|---|
Same string repeated, dataintegrity differs from 192 |
Quality transition triggered the write | dataintegrity column in the historian table |
| Repeats spaced just over the minimum time apart | A transition was discarded inside the window | Tag History settings, minimum time between samples |
| Repeats at irregular intervals | Source value or OPC quality flapping | Tag quality in the Designer tag browser, device connection status |
| Identical rows with quality 192 throughout | Value flips and reverts, or a forced periodic write | Test at minimum time 0, then check maximum time between samples |
If every repeated row carries 192, the writes are not quality-driven at all, and you should look at the string source or the maximum time setting instead.
How do I separate a tag fault from a historian setting? #
Check the tag and the history configuration as two independent layers, because a stable tag with an aggressive setting and a flapping tag with a correct setting produce similar tables.
- Tag side: watch the tag in the Designer tag browser for several minutes. Any flicker away from Good points at the driver, device connection or OPC item, not at the historian.
- Historian side: review the tag's History settings: sample mode, minimum time between samples, maximum time between samples, and deadband. A maximum time setting forces periodic writes whether or not the tag changed, which produces identical rows at a fixed interval.
Note that for string tags the deadband does not filter the way it does for numerics: the comparison is exact on the string, so trailing whitespace or a single changed character registers as a new value even when the text looks identical in the table.
How do I capture the transition that caused the row? #
Set the minimum time between samples to 0 on one test tag and include dataintegrity in your query, then the discarded transitions become visible rows.
- Open the tag's History configuration in the Designer.
- Set minimum time between samples to 0 on that single tag only.
- Let it run and query the historian table sorted by timestamp, selecting both the string column and
dataintegrity. - Look for rows where the string is identical but the code differs from 192, or where the value alternates and returns.
- Correlate those timestamps with device connection status and OPC diagnostics to find the source of the flapping.
- Restore the production minimum time after the diagnosis window.
Worked example: suppose the repeats in your table sit at 10:00:00 and 10:00:12, both showing the string "BATCH_A". At minimum time 0 the same period shows three rows: 10:00:00 with dataintegrity 192, 10:00:05 with 500 (a quality fault), and 10:00:12 with 192. The row at 10:00:05 was discarded under the 10 second setting, which is exactly why the 10:00:12 row looked like a duplicate. Count the rows your query returns the same way you would count the results of any SQL query against the historian, using a timestamp range wide enough to cover the repeat interval.
What should the table show once it is fixed? #
Every row should differ from its predecessor in either the string value or the dataintegrity code, with quality holding at 192 during normal running. The fix follows the cause:
| Cause found | Fix |
|---|---|
| Quality flapping from the device or OPC item | Repair the connection, polling rate or timeout at the driver; repeats stop once quality holds at 192 |
| String value changes and reverts | Correct the source logic writing the string, or filter transient values upstream |
| Transitions are real but too noisy | Keep a minimum time that suits the process and accept that fast transitions go unrecorded |
Fix the tag when both a tag repair and a longer minimum time would stop the repeats. A longer minimum only hides the transitions and leaves the underlying fault in place, while a stable tag produces clean history at any setting. If identical rows with quality 192 still appear after the tag is stable, check the maximum time between samples, and check your retention and row-count expectations against how tag count and write rate drive historian database sizing — the trade-offs are the same ones that decide how tag count and write rate drive historian database sizing when a historian grows.
One caution: never delete or edit rows in the historian tables to remove the apparent duplicates. Adjust the tag or the source instead, so the history stays a faithful record of what the tag actually reported.
Questions asked
How do I see the quality code stored with each row?
Include the dataintegrity column in your query against the historian table. A healthy row carries 192, which means Good. Rows with the same string but a different code were written by a quality transition, not by a value change, and that difference is what makes the On Change mode fire.
Does setting minimum time between samples to 0 hurt performance?
It can. Every value or quality transition on the tag becomes an immediate write, so a noisy tag on a busy database writes far more rows. Run the 0 second setting on a single test tag for the diagnosis window only, then restore the production setting on that tag.
Why does my string tag repeat rows but my numeric tags do not?
Numeric tags usually have a deadband configured, so small fluctuations are filtered before the historian sees them. String tags are compared exactly, with no deadband, so any value change or quality transition passes straight through to the On Change logic and can produce an apparently identical row.
Can a trailing space in a string cause a write?
Yes. The historian compares the string exactly, so a value that changes from one text to the same text with a trailing space, or with one character different, is a new value even though it displays identically in a table view. Trim or normalize the string upstream if this matters for your process.
What if every repeated row shows quality 192 in dataintegrity?
Then the writes are not quality-driven. Check whether the string value itself alternates and returns inside the sample window, and check whether a maximum time between samples is configured, because that setting forces a periodic write whether or not the tag changed.