Skip to main content
Pre-aggregated caches are typically rebuilt in full on each refresh. For large aggregates, a full rebuild can be slow or expensive. Incremental updates let you compute only the changed rows and merge them into the existing table.
Read Aggregate Aware Caching first - this page assumes you already have a working aggregate dynamic dataset.

How it works

The incremental pattern uses two dynamic datasets: After each delta deployment, you merge or append the delta rows into the base table using a MERGE or INSERT INTO statement.

Setup

1. Create the base aggregate

Create a dynamic dataset with the dimension keys and metrics you want to cache. Enable it as a pre-aggregate cache:

2. Create the delta aggregate

Duplicate the base aggregate and add a date filter for the incremental window (e.g. last day or last 7 days). The delta is a staging table - do not set use_for_cache on it.
Both tables share the same schema. The delta is a filtered subset of the base: Base aggregate (preagg_orders) - full history: Delta (preagg_orders_delta) - yesterday only (date.date >= CURRENT_DATE - 1): Base aggregate (preagg_orders) - after incremental run:
Do not set use_for_cache on the delta aggregate. If the delta is registered as a cache, queries may be served from partial data.

3. Initial deployment

Deploy the base aggregate once to populate the full historical table, using the Honeydew UI or deployment API.

Incremental update strategies

Both phases run entirely inside your orchestrator (Airflow, dbt, or similar):
  1. Deploy the delta - your orchestrator calls the Honeydew API to compute and write the delta dataset to a staging table. See Set up with ETL tools.
  2. Merge or append - your orchestrator then runs the SQL below to move the delta rows into the base aggregate table.

Append - new records only

Use this when source records are immutable after they are written (e.g. event logs where past dates never change). 1. Call the Honeydew API to compute and write the delta dataset for yesterday. 2. Your orchestration tool runs:

Merge - backfill and append

Use this when source records can change after the fact (e.g. orders that are updated for up to 7 days). Widen the delta filter to cover the backfill window, then use MERGE to update existing rows and insert new ones. 1. Update the filter in preagg_orders_delta to date.date >= CURRENT_DATE - 7. 2. Call the Honeydew API to compute and write the delta dataset. 3. Your orchestration tool executes:
Honeydew column names follow the format entity.attribute. Use double quotes in Snowflake ("date.date") and backticks in Databricks (`date.date`). List all columns explicitly in MERGE statements - wildcards are not supported.
Use IS NOT DISTINCT FROM instead of = in the ON clause so that NULL dimension values match correctly across rows.