Request a demo

Glossary · Data observability and quality

What is data volume anomaly?

A data volume anomaly is an unexpected change in how many rows a table receives or holds, such as a daily load with half the usual rows, a sudden spike of duplicates or a table that shrank. Loads that succeed with the wrong amount of data are a common source of silent errors.

Also called: volume anomaly, row count anomaly, data volume check, missing data, row count drop

What a volume anomaly looks like

Volume problems pass every technical check. The job succeeds, the schema matches and the table is fresh, but:

  • a daily partition has 40% of its usual rows because one source file was missing;
  • an hourly load wrote nothing for three hours while still updating the table;
  • a retry appended the same batch twice;
  • a DELETE with a wrong filter removed history.

Downstream, totals drop, conversion rates jump and models train on partial data, without any error.

Detect it on BigQuery

For partitioned tables, INFORMATION_SCHEMA.PARTITIONS (in Preview) holds a row count per partition, which makes a baseline comparison cheap. This query compares yesterday's partition with the average of the four previous same weekdays:

WITH daily AS (
  SELECT
    table_name,
    PARSE_DATE('%Y%m%d', partition_id) AS day,
    total_rows
  FROM analytics.INFORMATION_SCHEMA.PARTITIONS
  WHERE REGEXP_CONTAINS(partition_id, r'^\d{8}$')
)
SELECT
  t.table_name,
  t.total_rows AS yesterday_rows,
  ROUND(AVG(h.total_rows)) AS usual_rows,
  ROUND(SAFE_DIVIDE(t.total_rows, AVG(h.total_rows)), 2) AS ratio
FROM daily AS t
JOIN daily AS h
  ON h.table_name = t.table_name
  AND h.day IN (DATE_SUB(t.day, INTERVAL 7 DAY), DATE_SUB(t.day, INTERVAL 14 DAY),
                DATE_SUB(t.day, INTERVAL 21 DAY), DATE_SUB(t.day, INTERVAL 28 DAY))
WHERE t.day = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
GROUP BY t.table_name, t.total_rows
HAVING ratio < 0.5 OR ratio > 2
ORDER BY ratio;

For DML pipelines, dml_statistics in INFORMATION_SCHEMA.JOBS records inserted, updated and deleted rows per job, which catches a MERGE that suddenly deletes far more than usual.

Fixed thresholds such as "alert below 50%" are a start, but they break on seasonal tables. Anomaly detection learns each table's weekly pattern and trend instead; tools such as Masthead do this from BigQuery metadata and logs across every table without reading data.

Pitfalls

  • Comparing to yesterday. Weekends, holidays and month ends make day-over-day comparisons noisy; compare with the same weekday.
  • Late-arriving data. A partition that is still filling looks like a drop. Check after the expected load window.
  • Only watching row counts. Rows can be complete but carry NULL in a key column; pair volume with value checks on critical columns.
  • Ignoring deletes. Shrinking tables are anomalies too, and time travel can restore them only for a few days.

FAQ

How do I detect a row count drop in BigQuery?

Compare each new partition's row count with the same table's recent history, for example the median or average of the previous few weeks on the same weekday. INFORMATION_SCHEMA.PARTITIONS gives row counts per partition from metadata, so the check does not scan the table.

Are volume spikes a problem too?

Often, yes. A sudden jump can mean a duplicated load, a backfill that ran twice or a join that started fanning out. Spikes also raise the cost of every downstream query that scans the table.

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.