Time-Series Data Modeling and Storage
A practical guide to emerging data architecture and AI-ready information.
A time-series record commonly identifies a measured subject, metric, timestamp and value. Include unit, source, quality status and relevant dimensions. State whether the timestamp marks observation, receipt or processing time.
Define an observation
A time-series record commonly identifies a measured subject, metric, timestamp and value. Include unit, source, quality status and relevant dimensions. State whether the timestamp marks observation, receipt or processing time.
Handle sampling and missingness
Document expected cadence, irregular intervals, duplicate timestamps, late readings, gaps and corrections. A missing observation is not automatically zero. Preserve quality flags and distinguish sensor failure, no measurement and a true zero where consumers need that difference.
Choose storage and aggregation
Select partitioning, indexing and retention based on write rates, query windows, cardinality and platform behavior. Decide how downsampling, interpolation and rollups are performed and label derived values. Validate that aggregation preserves the signal relevant to the use.
Preserve context
Sensor identity, calibration, location, operating conditions and model version can shape interpretation. Record context changes and provenance. Test out-of-order data, daylight transitions, unit conversion and device replacement.
Validate and govern
Test with representative inputs, document assumptions and limitations, and assign owners for quality, access, provenance and change. Reassess controls when sources, models, users or intended decisions change.
Define what one observation represents
A time-series record should identify the measured subject, metric, observation time, value and relevant units or quality state. State whether timestamps represent event time, sampling time or ingestion time. Include sensor or source identity where multiple producers can report the same metric. Without these details, a sequence of values may be impossible to interpret or compare.
Define expected cadence and how gaps, duplicates, outliers and late measurements are handled. A missing reading is not necessarily zero. Record calibration or transformation context when it affects interpretation, and preserve the original reading when a correction must remain traceable.
Choose a temporal grain for each use
Raw observations, minute-level aggregates and daily summaries answer different questions. Aggregation can reduce storage and query effort but loses detail and may hide spikes or short-lived events. Specify the window boundaries, timezone, aggregation function and treatment of incomplete windows. Keep enough raw or intermediate evidence for the required audit or reprocessing use case.
Model time and entity changes
Subjects and sensors can change identifiers, locations, ownership or calibration over time. Decide whether a historical measurement should use the entity attributes valid at observation time or current attributes. If both views matter, retain effective-dated relationships or an explicit snapshot. Avoid joining old measurements to today's configuration without labeling the result.
For irregular events, do not assume fixed intervals. Store observation timestamps and derive windows according to a documented rule. For periodic sampling, monitor missing intervals and clock drift. Compare event time with arrival time to measure pipeline delay.
Validate and operate the series
- Is subject identity stable and correctly scoped?
- Are timestamps, timezone and cadence explicit?
- Can missing values be distinguished from zero?
- Are aggregation and window rules reproducible?
- Are outliers, duplicate readings and late arrivals observable?
- Can historical configuration be reconstructed when needed?
Test with a normal series, a gap, a duplicate, a late correction and a daylight-saving boundary where relevant. Monitor ingestion lag and expected coverage over time.
Worked example: irregular sensor observations
Store observation time, receipt time, sensor identity, metric, value, unit, quality flag, and calibration or source context. Irregular sampling means a missing interval is not automatically zero. Distinguish no observation, sensor offline, invalid reading, and measured zero. If values are resampled, document the method and interval alignment.
Aggregations such as average, minimum, maximum, and last value answer different questions. Preserve count and coverage alongside summaries so users can assess completeness. Timezone and daylight-saving behavior matter for local operational windows. Corrections should point to the original observation and record their reason.
Validate time-series design
Test duplicate timestamps, out-of-order events, missing periods, unit changes, and sensor replacement. Choose partitioning and retention based on query patterns and approved lifecycle. Compare aggregates with raw observations on samples. Monitor late data and sensor quality, not only storage and query latency.
Design time-series serving and rollups
Define common resolutions and aggregation functions for each consumer. Preserve counts and coverage with averages, and retain raw or higher-resolution data only as approved. Align windows consistently and identify whether boundaries are inclusive or half-open.
Benchmark recent-range queries, long-term trends, and high-cardinality sensors. Set retention and downsampling rules that preserve required analysis. Monitor late corrections and ensure derived rollups can be rebuilt.
Manage time-series corrections
Record correction source, event and receipt time, affected windows, and rollup versions. Define whether consumers see restated values or adjustments. Test reprocessing without duplicating observations.
Monitor late arrivals and changes to sensor calibration or units. Document how derived aggregates are rebuilt.