How-to
Bridge Ignition tag history after a tag path change
Short answer
Yes — the data is intact, and two database repairs bridge it onto the current path. Repoint the old sqlth_te entry at the current tag path and set its retired timestamp at the cutover, or rewrite the old tagid to the new one in every sqlt_data_x_xxxx partition and pull the new entry's created timestamp back. Disable the history provider first, because tag metadata is cached in RAM.
On this page
Yes — the trend can be bridged. The old rows are still in the database, and two database repairs stitch them onto the current tag path: either repoint the old entry in sqlth_te at the current path and set its retired timestamp at the cutover, or rewrite the old tagid to the new tagid in every sqlt_data_x_xxxx partition and pull the new entry's created timestamp back over the old data. Disable the tag history provider before editing either table, because the historian caches tag metadata in RAM and will not notice edits made while it runs. Default to the first repair: it changes one metadata row per tag instead of thousands of sample rows.
How the path change splits one signal into two identities #
Sampled values live in data partitions named sqlt_data_x_xxxx, keyed by a numeric tagid, not by tag path. The mapping from path to tagid lives in sqlth_te, where each row carries one identity: its path, a created timestamp, and a retired timestamp. The Ignition database table reference documents the behavior these repairs rely on — the retired column is set when tag history is disabled or the tag path changes, and a deleted tag is marked retired as well. An entry flagged retired receives no further inserts.
Moving tags into different subfolders changes their paths. The historian registers each new path as a new identity with a new tagid and writes new samples under it, while the old rows keep the old tagid. A Power Chart resolves the currently configured path to the active tagid and reads only that identity's partitions, so the trend begins at the move and everything before it disappears from the screen. The data is intact; the lookup is split.
Left unrepaired, the old rows sit in their partitions and drop away only when setting historian pruning and retention for Ignition tag history ages them out. Stitching two identities inside one database is also a smaller job than merging the history blocks of two historian servers, which is the procedure when the split runs between machines rather than between paths.
Choose the repair that fits #
| Repair | Tables touched | What changes | Pick it when |
|---|---|---|---|
| Repoint the metadata | sqlth_te only |
The old entry's path becomes the current path; its retired timestamp is set at the cutover | Default choice — recorded samples are untouched |
| Consolidate the tagid | Every sqlt_data_x_xxxx holding the old tagid, plus sqlth_te |
The old tagid becomes the new tagid in each partition; the new entry's created timestamp moves back | A single permanent tagid is required downstream |
Take the metadata repair unless something downstream — a report, a feed, an external query — keys on the physical tagid. It edits one row per tag and cannot alter a stored value. The rewrite is justified only when one tagid must own the whole history, and its cost grows with every partition that holds the old id.
Prepare the database and the provider #
- Back up the historian database and prove the backup restores before anything else. Everything below edits history tables directly.
- Disable the tag history provider in the gateway configuration. The historian keeps much of this metadata cached in RAM, and edits made with the provider live can go unnoticed; re-enabling it forces a reload from the tables.
- In
sqlth_te, find both entries for the tag. Match the complete path, folders included, not just the leaf name, and record the tagid, created and retired values of both rows. - In the partitions, confirm the split: the old tagid owns the earlier samples, the new tagid the later ones. Note the timestamp of the last old-id sample and of the first new-id sample — between them lies the cutover.
- Proceed only when both identities measured the same physical signal. Two different measurements that ever shared a path must not be stitched into one lineage.
Repair 1: repoint the old entry in sqlth_te #
- Inside a transaction, update the old row so its path column holds the current tag path, and set its retired value to the cutover instant:
UPDATE sqlth_te
SET retired = 1666189800000
WHERE tagid = 5051;
- Set the path column of that same row to the current tag path, in the same transaction or in the database's table editor.
- Review the affected row, commit, then re-enable the history provider and reload the trend.
The example values are illustrative: tagid 5051 is the old identity and 5188 the new one, with the retired value derived below.
Worked example: the retired value in epoch milliseconds #
The created and retired columns hold epoch milliseconds — 13-digit integers — so the cutover instant must be converted before it is entered. Say the tag moved on 2022-10-19 and the cutover is taken as 14:30:00 UTC:
- 1970-01-01 to 2022-01-01: 52 × 365 + 13 leap days = 18,993 days
- 2022-01-01 to 2022-10-19: 291 days
- 19,284 days × 86,400 s/day = 1,666,137,600 s
- 14 h × 3,600 s + 30 min × 60 s = 52,200 s, so 1,666,137,600 + 52,200 = 1,666,189,800 s
- × 1,000 = 1,666,189,800,000 ms
That value assumes UTC; every hour of timezone offset moves the boundary by 3,600,000 ms, so fix the zone before committing. The stronger method is to read the first new-id sample's timestamp directly from its partition and enter that exact number. These are the same millisecond values involved in converting historian CSV timestamps in Excel, so the same arithmetic checks them.
Repair 2: consolidate the samples under the new tagid #
- With the provider disabled and the backup verified, list every partition that contains the old tagid, and record the row count in each (
x_xxxxis each partition's actual suffix):
SELECT COUNT(*) FROM sqlt_data_x_xxxx WHERE tagid = 5051;
- Rewrite the id in each of those partitions:
UPDATE sqlt_data_x_xxxx
SET tagid = 5188
WHERE tagid = 5051;
- Check the guardrail with row counts. With illustrative counts of 8,412 rows under tagid 5051 and 3,105 under 5188 before the rewrite, the result must be 8,412 + 3,105 = 11,517 rows under 5188 and zero under 5051. Any other number means the condition caught more or less than intended — roll back and correct it deliberately.
- Pull the new identity's validity back: set the created value on the new
sqlth_terow to the old entry's created value, so its window covers the earliest reassigned sample. - The old entry is now a retired row with no data. Removing it is optional and has its own procedure for safely deleting retired tag rows from the sqlt_te table.
- Re-enable the provider.
Verify the bridged trend #
- Confirm fresh samples arrive under the active identity and that no third entry appears in
sqlth_tefor the current path. - Query the current path across three windows: well before the cutover, across it, and after it. All three must return data.
- Cross-check several returned values against direct reads of the partitions for the two original tagids — same timestamps, same values.
- Open the Power Chart over the full retained range and inspect the cutover: no gap, no duplicated interval, no step beyond what the signal itself does.
- If a gap remains at the cutover, it is a real logging outage. These repairs join identities; they cannot create samples that were never stored.
Questions asked
Will renaming the tag back to its old path restore the old trend?
No, and it often makes things worse. A retired identity does not go back into service — the historian will not insert into an entry flagged retired — so the reverse rename typically registers a third identity and splits the trend three ways. Use one of the two database repairs instead; both leave every recorded sample under ids the current path can reach.
Can I paste a readable date straight into the retired column?
No. The created and retired columns hold integer epoch milliseconds, not date strings. A formatted date either fails against the column's integer type or stores a meaningless number. Convert the cutover instant to milliseconds first, fix the timezone explicitly, and verify the value against a sample timestamp already in the partitions before committing.
Does it matter which history provider the two entries belong to?
Yes. Each row in the tag table is tied to a specific history driver, so both identities must belong to the same history provider and the same database. Entries from different providers cannot be stitched into one lineage, because the samples sit in two databases a single query cannot reach. Confirm the provider on both rows before merging.
Can I bridge several renamed tags in one pass?
Yes — both repairs are set-based. The metadata method is one UPDATE per old entry; the rewrite is one UPDATE per partition that holds each old tagid. Run each batch in a single transaction, record row counts per tagid before and after, and re-enable the provider only when every count reconciles.