Request a demo

Glossary · Data observability and quality

What is data anomaly detection?

Data anomaly detection automatically flags tables and pipelines that behave differently from their own history, such as late updates, unusual row counts, schema changes or new job failures, by learning normal patterns instead of relying on hand-written thresholds.

Also called: anomaly detection, automated data monitoring, ML-based data monitoring, outlier detection for data

What gets monitored

Anomaly detection applies the same idea to several signals of each table:

  • Freshness: the table updated later than its usual rhythm, or not at all (data freshness).
  • Volume: rows added or total rows far outside the normal range (data volume anomaly).
  • Schema: a column appeared, disappeared or changed type (schema change).
  • Pipeline behaviour: new error types, retries, runtimes or slot usage far above normal.
  • Values: distributions, null rates or distinct counts of important columns.

How it works

Each signal is a time series per table. A model of its normal behaviour, which can be as simple as a rolling median with a tolerance band or as involved as a seasonal forecast, produces an expected range, and points outside it become alerts. Good models handle weekly seasonality, trends, holidays and tables that update irregularly, because those are what make fixed thresholds noisy.

A simple statistical version in BigQuery flags daily loads outside three standard deviations of the previous four weeks:

WITH daily AS (
  SELECT DATE(creation_time) AS day, SUM(dml_statistics.inserted_row_count) AS inserted_rows
  FROM `region-us`.INFORMATION_SCHEMA.JOBS
  WHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 35 DAY)
    AND destination_table.dataset_id = 'analytics'
    AND destination_table.table_id = 'orders'
    AND error_result IS NULL
  GROUP BY day
),
scored AS (
  SELECT
    day,
    inserted_rows,
    AVG(inserted_rows) OVER w AS mean_rows,
    STDDEV(inserted_rows) OVER w AS sd_rows
  FROM daily
  WINDOW w AS (ORDER BY day ROWS BETWEEN 28 PRECEDING AND 1 PRECEDING)
)
SELECT day, inserted_rows, ROUND(mean_rows) AS mean_rows
FROM scored
WHERE ABS(inserted_rows - mean_rows) > 3 * sd_rows
ORDER BY day DESC;

It works for one table. Across thousands of tables, the hard parts are learning per-table patterns, suppressing duplicate alerts and pointing to the root cause, which is where lineage comes in. Masthead is an example of doing this from BigQuery logs and metadata across every project, with no rules to configure and no access to the data.

Cost of detection

Checks that read data cost bytes or slots on every run, and scheduled SQL checks on large tables can become a noticeable line on the bill. Metadata-based checks cost almost nothing per table, which is why they are practical for full coverage while value checks are kept for the most important columns.

Pitfalls

  • Alert fatigue. Too-sensitive models train people to ignore alerts; tune per table and route by owner.
  • Learning from broken history. A model trained on a period that already contained the problem treats it as normal.
  • No context. An alert without affected downstream assets and an owner turns into a ticket nobody picks up. Feed alerts into a data incident process.

FAQ

What is the difference between anomaly detection and data quality tests?

Tests check rules you wrote in advance, such as order_id is unique, on the tables you chose. Anomaly detection learns what normal looks like for every table and flags deviations nobody wrote a rule for. Mature teams use both.

Does data anomaly detection need to read my data?

Not for freshness, volume, schema and pipeline anomalies: on BigQuery these come from metadata, INFORMATION_SCHEMA and audit logs. Anomalies in values, such as a column's average or null rate, require reading or profiling the data.

Read next

Browse the full glossary

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.