Lifecycle policies
Functions that govern how chunks age out of the hot tier (Lakebase). The actual work is performed by Databricks Jobs on a schedule; these functions register the policy and provide manual overrides. LakeTS only ever removes data from Lakebase — the Unity Catalog Managed Table copy is retained.
Tiering
Tiering validates that a chunk is durable in the Unity Catalog Managed Table (via Lakebase CDF) and flags it tiered. The chunk's data stays in Lakebase and remains queryable; the partition is physically removed later by retention at drop_after. The Databricks Tiering job drives the validation.
CDF must be enabled and the table CDF-synced via lakets.enable_sync() before any chunk is flagged — see Lakebase CDF Setup.
add_tiering_policy(p_table_name, p_after, p_schema_name)
Registers a tiering policy for a ChronoTable. Also installs the triggers that stamp each chunk's last_write_lsn (used by the durability gate). Creates the policy even if the table isn't CDF-synced yet (with a NOTICE), but no chunk is flagged until sync and CDF are live.
| Parameter | Type | Default | Description |
|---|---|---|---|
p_table_name | TEXT | — | ChronoTable name |
p_after | INTERVAL | — | Validate + flag chunks older than this |
p_schema_name | TEXT | 'public' | Schema |
Returns: INT — policy_id
-- Flag chunks older than 7 days as durable-in-UC
SELECT lakets.add_tiering_policy('metrics', '7 days');