Time-series data

On this page 7

Time-series data is a sequence of observations ordered by time, in which each value is paired with the timestamp at which it was measured or recorded. Sensor readings every second, daily closing prices, hourly web traffic and monthly unemployment figures are all time series. What sets them apart is that order carries meaning: shuffling the rows destroys the information they hold.

Among data fundamentals, time-series data is a distinct shape of structured data with its own vocabulary, storage engines and statistical methods. Because consecutive values are usually related, analysts treat temporal dependence, trend and seasonality as properties to model, not as noise to ignore.

Anatomy of a time series

Every time series combines a time index, one or more measured values and descriptive context. In monitoring systems the context is often stored as tags or labels, such as the host name or sensor location, so one metric name can describe thousands of separate series.

The table below lists the core elements and what each one controls.

ElementMeaningExample
TimestampMoment of measurement, ideally in UTC2026-11-16T08:00:00Z
ValueNumeric or categorical observation21.4 degrees Celsius
Sampling intervalSpacing between observations1 second, 1 hour, 1 month
Tags or dimensionsContext identifying the seriessite=plant-2, sensor=t7
ResolutionPrecision of the timestampSeconds, milliseconds, nanoseconds
Core elements of time-series data

A crucial distinction is between event time and ingestion time. Event time is when something actually happened, while ingestion time is when the system received the record. Network delays and offline devices make the two diverge, so pipelines that aggregate by ingestion time can misplace late-arriving data into the wrong window.

Regular, irregular and other kinds of series

Time series differ mainly in how observations are spaced and what they represent. These differences decide which storage layout and which analytical methods are appropriate.

KindSpacingTypical sourceAnalytical note
Regular seriesFixed intervalPolling sensors, metrics scrapersSuits classical forecasting models
Irregular seriesVariable intervalTransactions, clicks, alarmsOften resampled or treated as events
Univariate seriesAnySingle measured quantitySimplest to model and plot
Multivariate seriesAnySeveral related measurementsCaptures interactions between variables
Panel dataAnyMany entities over timeCombines cross-section and time
Common kinds of time-series data

Irregular streams are frequently converted to regular ones through resampling, which groups observations into fixed buckets using a function such as mean, sum, minimum, maximum or last value. Choosing the wrong function changes meaning: summing a temperature is meaningless, while averaging a request count understates total load.

Statistical properties that shape analysis

Time-series analysis rests on a few structural components that describe how values evolve. Recognizing them is the first step in any forecast or anomaly detection task.

  • Trend: a long-term upward or downward movement, such as steady growth in user numbers.
  • Seasonality: patterns that repeat at a fixed period, such as daily, weekly or yearly cycles.
  • Cyclic behavior: rises and falls without a fixed period, typical of economic indicators.
  • Autocorrelation: the degree to which a value resembles earlier values at a given lag.
  • Stationarity: constant mean and variance over time, an assumption of many classical models.

Because observations depend on one another, standard random train-test splits are invalid for time-series models. Validation must respect chronology, typically through rolling or expanding windows, otherwise future information leaks into training and accuracy is badly overstated. Methods range from exponential smoothing and ARIMA to gradient-boosted trees with lag features and deep sequence models.

Storing and querying time-series data

Time-series workloads are write-heavy, append-mostly and read in time ranges, a profile that general-purpose transactional databases handle inefficiently at scale. Specialized time-series databases therefore partition data into time chunks, compress neighboring values aggressively and offer built-in functions for downsampling and gap filling.

The following comparison shows how common storage approaches suit different needs.

ApproachStrengthWeaknessGood fit
Time-series databaseHigh ingest, compression, time functionsNarrower general query supportMetrics, IoT telemetry
Relational table with time partitionsJoins with business data, SQLNeeds careful indexing at volumeModerate volumes, mixed workloads
Columnar files in a data lakeCheap long-term storage, analyticsNot suited to real-time readsHistorical analysis, model training
Stream platformLow-latency processingLimited retention and queryingReal-time alerting
Storage options for time-series data

Two design decisions dominate cost. Retention and downsampling policies keep raw data for a short period, perhaps 14 to 30 days, and summaries for years. Cardinality, the number of distinct tag combinations, drives index size; attaching a unique identifier such as a request ID as a tag can multiply series counts into the millions and degrade performance.

Pitfalls when working with time series

Most errors with time-series data come from mishandled time itself rather than from the values. The table summarizes recurring problems.

ProblemEffectFix
Mixed time zonesShifted or duplicated hoursStore UTC, convert only for display
Daylight saving transitionsMissing or repeated local hoursUse timezone-aware timestamps
Unsynchronized clocksOut-of-order eventsSynchronize devices with NTP
Silent gapsMisleading averages and chartsMark gaps explicitly before filling
Future leakage in featuresInflated model accuracyBuild features only from past values
Frequent time-series problems and fixes

Gap filling deserves special care. Forward filling, interpolation and zero filling each encode a different assumption about what happened while data was missing, and the right choice depends on the physical process. Recording which values were imputed preserves data quality and lineage for later users.

The idea in brief

Time-series data is simply a list of measurements with the time each one was taken. A fitness tracker that logs your heart rate every minute, a thermometer that reports every hour or a shop counting sales each day all produce it.

The key idea is that the order tells a story. Reading the values one after another shows whether something is rising, falling, repeating every weekend or suddenly behaving strangely. That is why people use time series to spot problems early and to predict what is likely to come next.

A practical scenario

A municipal water utility installs pressure and flow sensors at 400 points across its network, each reporting every 15 seconds. That produces roughly 2.3 million readings per day, which the utility stores in a time-series database with raw data kept for 30 days and one-minute averages kept for five years.

Engineers build a model that learns each sensor’s daily and weekly pattern, including morning demand peaks and lower weekend usage. One night, flow in a residential district stays 18 percent above its usual 03:00 level for two hours while pressure drifts downward. The deviation triggers an alert, a crew locates a broken main before it surfaces, and the utility cuts water loss and repair time compared with waiting for customer complaints.