PI historical backfill and real-time continuation
Historical backfill reads a bounded archived range, while real-time tasks subscribe to subsequent changes. Both task types share the connection identity and model, but not progress or recovery state. This page uses a meter Point for initial verification, then explains scope expansion, historical maintenance, and real-time continuation.
Entry point: taosExplorer → Data Ingestion → PI backfill or PI. Check the target in the taosExplorer Data Browser or taos CLI.
1. Historical backfill
- Create PI backfill, and select a separate test database and the actual Windows collection host or agent.
- Verify source archived data using the same identity. Limit the scope using PI dataset filtering, then review the
Meter_001_Voltagemapping using PI model configuration files. For AF multi-column mode, first verify the template scope as well. - Enter full start and end times, and record the time zone and source boundary records. Initially choose a one-minute range that actually contains archived events. Do not treat interpolated curve points as archived event counts.
- Submit and start the task. Monitor errors and target data. Completion only means the range has finished processing; the data still needs verification.
- Spot-check individual records for the same Point, time, and value/status. After verification, expand by Point group or contiguous time window. Do not immediately start large annual backfills.
Run these queries in the target cluster's taosExplorer Data Browser or taos CLI. They use a one-minute example window; replace the start and end times with actual values:
SELECT COUNT(*), MIN(ts), MAX(ts)
FROM pi_demo.`Meter_001_Voltage`
WHERE ts >= '2024-01-01T00:00:00.000Z'
AND ts < '2024-01-01T00:01:00.000Z';
SELECT ts, value, status
FROM pi_demo.`Meter_001_Voltage`
WHERE ts >= '2024-01-01T00:00:00.000Z'
AND ts < '2024-01-01T00:01:00.000Z'
ORDER BY ts;
Differences between source and target precision, repeated updates to the same primary key, and quality filtering all affect row counts. Align the comparison criteria first. Before expanding to long periods such as a year, confirm that readable source archives exist and that target database retention covers the entire backfill period. Then split it into adjacent windows with explicit start and end times according to business workload, such as the start of one year to the start of the next. Do not substitute the date of the previous year's last day for the end time. Endpoint inclusion rules for each task must match data verification. Check adjacent boundaries first, then decide whether to retain controlled overlap.
2. Real-time tasks and compensation
Create a PI task using the reviewed model, initially disabling scope-expansion and deletion options. After starting, ask the administrator to produce an approved new value for Meter_001_Voltage. Check the source time, value, and status at the target. Only after verification should production maintenance switches be evaluated. Verify multi-column template scope separately as described in Dataset filtering.
Restart Compensation Time controls a finite historical lookback window before the current time during recovery. It does not guarantee recovery of every event missed during an interruption, nor does it represent the business's tolerable data-loss period. Interruption duration, late historical data, and lost original state may exceed this range. Record the actual gaps and use backfill to fill them.
The direct DSN compensation key is MaxBackfillRangeDays. Days in the name does not mean a unitless number of days should be entered. Explicit backfill requires start and end times with time zones. Parseable flags such as BackfillStartTime=auto and FromTDengineLastTime do not guarantee that a production task resumes automatically from the target. For units, aliases, and entry-point differences, see PI connection and runtime parameters.
Single-column mode writes Point changes to the corresponding child table. Multi-column mode writes element attribute changes to the corresponding data columns. An unchanged attribute in multi-column mode is not a source null value, and the latest row is not necessarily a complete snapshot of all attributes.
3. Automatically synchronize new Points
Automatic addition applies only to real-time tasks with saved, replayable filter rules and is disabled by default. Fixed Point lists, CSV files without rules, and PI backfill do not have the same scope-expansion capability. Scanning, modeling, and subscribing all take time; the default scan interval is not an ingestion latency guarantee.
| Source change | Handling when enabled | Does not mean |
|---|---|---|
| A name rule matches a new PI Point | Add it to real-time collection and create the required target | Automatically backfill the new Point's existing history. |
| A PI Point attribute is added to an existing AF template | Ingest the attribute and add the required columns in multi-column mode | All type changes are automatically compatible. |
| An element/path rule without a template restriction matches a new element | Ingest newly matching elements and attributes | Assets outside the rules are included too. |
| A source object disappears or an existing object changes type | The addition feature does not automatically delete child tables or perform arbitrary schema migrations | It can serve as a source-deletion synchronization or model-upgrade mechanism. |
When enabling automatic addition, disable the existing Synchronize New Elements and Synchronize Deleted Elements options; they cannot be enabled at the same time. Check actual values after saving. Do not assume that defaults for new tasks apply to copied or edited tasks. For conflicting objects, check logs, types, and mappings. Do not rewrite production tables simply to bypass a conflict.
4. Existing multi-column maintenance options
These options synchronize source changes for multi-column real-time models. Check each one during initial ingestion; page defaults do not replace approval.
| Option | Effect | Impact and verification |
|---|---|---|
| Synchronize New Elements | Listen for new elements of the existing AF templates | Do not enable together with automatic addition; verify using an approved test element. |
| Synchronize Static Attribute Changes | Synchronize static attribute changes to target tags | Check actual attributes and tag values; disabling it stops continuous refresh. |
| Synchronize Deleted Elements | Source element deletion can delete the target child table | Historical data may be lost; enable only after approval and backup. |
| Synchronize Deleted Historical Data | Set data columns at the corresponding times to null | This is not physical deletion of the entire target table; total row count cannot determine whether synchronization occurred. |
| Synchronize Modified Historical Data | Update the corresponding target data with historical corrections | Check original times, values, and status; handle writes overlapping backfill carefully. |
Source-deletion synchronization is not a backup. Deleting an element may also delete its historical target table, and setting historical values to null changes original records. Historical deletion and modification switches are not master switches for all source historical changes. Disabling both does not guarantee that target history remains unchanged. For AF analysis recalculation or interval deletion, check the entire affected period in an isolated target. If retaining history is a business requirement, first prepare an independent backup or retention policy, then confirm how the accompanying plugin handles these events and which settings apply. Until confirmed, do not experiment on a target that must retain history.
5. Historical and real-time continuation
| Order | Procedure | Boundaries to verify |
|---|---|---|
| Backfill first, then real-time | Backfill to an explicit cutover point, then start real-time collection and schedule backfill covering the continuation window | Check the gap between backfill completion and the real-time subscription taking effect, and whether compensation covers it. |
| Real-time first, then backfill | Confirm continuous real-time ingestion, then backfill the historical range | Check PI and target read/write load, primary keys in overlapping ranges, and the update policy. |
Overwriting the same primary key can handle some replay, but different models, precision, and quality policies can still cause duplication or loss. After completion, compare counts, boundaries, and values/status by Point group. Include unresolved gaps in cutover verification. For cross-source continuation between PI and WinCC, see PI historical backfill and WinCC real-time collection.
6. Load and troubleshooting
Batch size affects per-batch writes and memory; it is not a strict PI read-rate limiter. Measure PI CPU/I/O, network usage, taosX backlog, and target writes before adjusting concurrency, scope, and batches. See Logs and performance and Tuning and resource control.
If history is absent, first check whether the same identity can read that window. For real-time delays, distinguish between the source not producing data and a subscription problem. For failed additions, first check the boundary between rules and the fixed CSV. After an interruption, retain the original task and data directory. Do not immediately create another task of the same name or clear state. For recovery steps, see PI task maintenance and recovery.
For other task, write, and runtime problems, see Troubleshooting by symptom.