Freshness (Update Time Gap)

Detects when the time since the last update of a table deviates from its usual update pattern.

The Freshness (Update Time Gap) monitor measures the time elapsed since a table was last updated, using the metadata of your data source, and alerts you when the table has not been updated for longer than usual.

When to Use

  • Tables without a time field: You want to know whether a table is still updated, but you do not want to rely on a time field, or the table has none.
  • Low-cost freshness checks: The monitor reads metadata only, so it does not scan the table, even when the table is large.
  • Update SLAs: Your data contract states that a table is refreshed at least once a day. Set a static threshold with a maximum of 86,400 seconds (24 hours).

To check that new rows arrive in each period based on a time field, use Freshness.

How It Works

At each run, Sifflet reads the last modification time of the table and computes the number of seconds elapsed since then. Each run produces one data point.

The last modification time comes from the following metadata:

Data sourceMetadata
BigQuerylast_modified_time in __TABLES__
DatabricksLAST_ALTERED in INFORMATION_SCHEMA.TABLES
MySQLUPDATE_TIME (or CREATE_TIME if empty) in information_schema.tables
OracleLAST_DDL_TIME in ALL_OBJECTS
SnowflakeLAST_ALTERED in INFORMATION_SCHEMA.TABLES

The monitor fails when the time gap is too long:

  • Dynamic (default): A machine learning (ML) model learns the usual update pattern of the table and predicts the expected time gap at each run. The monitor fails when the time gap is above the predicted upper bound. A short time gap never makes the monitor fail.
  • Static: The monitor fails when the time gap is outside the minimum and maximum you set, in seconds.

The dynamic threshold needs training time: wait a few update cycles of the table before relying on the results.

The graph shows the time elapsed since the last update at each run. It drops to zero after each update.

Example

You want to know when the nightly synchronization of customers does not run. Create a Freshness (Update Time Gap) monitor on customers with the following settings:

  • Schedule: Hourly (@hourly).
  • Threshold: Dynamic (default).

customers is usually updated every night at about 2am, so the time gap measured at 8am is about 6 hours. One night, the synchronization fails. At 8am the next day, the time gap is 30 hours, above the expected upper bound, so the monitor fails.

Freshness (Update Time Gap) graph

Configure the Monitor

📝 Note: This template is only available on BigQuery, Databricks, MySQL, Oracle, and Snowflake. See Supported Data Sources.

Freshness (Update Time Gap) Settings

SettingDescriptionDefault
Excluded datesCalendars of dates on which Sifflet does not raise alerts, for example weekends or public holidays. See Special Dates Handling.None

Common Settings

  • Schedule: The monitor measures the time gap only when it runs, so run it more often than the table is updated. For a table refreshed daily, run the monitor hourly (@hourly) to get one data point per hour. See Scheduling.
  • Threshold: Dynamic (default) or static. The sensitivity of the dynamic threshold cannot be changed, and relative thresholds are not available. See Thresholds.
  • There is no scan mode, where clause, group by, or join: the monitor reads table metadata and does not query the rows.

Monitor as Code

The monitor kind is MetadataFreshness. The following YAML creates the monitor of the example, with the default dynamic threshold:

kind: MetadataFreshness

The following monitor fails when the table has not been updated for more than 24 hours:

kind: MetadataFreshness
threshold:
  kind: Static
  max: 86400

A static threshold only supports comparisonMode: Absolute. See the Parameters reference.

Limitations

  • On Oracle, LAST_DDL_TIME changes when the table structure changes, which does not always match data loads.
  • Views are not supported, because they have no last update time.

Related Templates

  • Freshness: Checks for new rows in each period, based on a time field of the table.

Did this page help you?