Translating classic Amazon Redshift physical tuning concepts (DISTKEY, SORTKEY, ENCODE, VACUUM) into modern Delta Lake & Unity Catalog Lakehouse equivalents—plus enabling Change Data Feed (CDF).
For over a decade, classic MPP warehouses like Amazon Redshift ran on fixed clusters of hard drives glued to CPU servers. To avoid catastrophic slowness, DBAs had to manually micromanage which physical hard drive held every row (`DISTKEY`), how every slice was sorted (`SORTKEY`), and how every column compressed (`ENCODE AZ64`).
Moving to a Delta Lakehouse decouples storage (S3/ADLS/GCS) from elastic compute—meaning most of Redshift's rigid hardware knobs turn into simpler, dynamic metadata features!
STL_* audit logs -> Unity Catalog System Tables & Delta History**.| Classic Redshift Concept | What It Did in Redshift | Modern Delta Lakehouse Equivalent | Why It Is Simpler / Better |
|---|---|---|---|
| `DISTKEY(col)` | Co-located matching join keys onto the same node's local SSD to reduce network shuffle. | `CLUSTER BY` + Broadcast Joins + AQE | Decoupled cloud compute doesn't pin data to fixed SSD nodes; AQE dynamically broadcasts small tables and fixes skew! |
| `SORTKEY(col)` | Physically kept rows ordered inside 1 MB blocks so zone maps skipped blocks. | Liquid Clustering (`CLUSTER BY`) + Min/Max Stats | Delta tracks min/max stats in _delta_log and lets you ALTER TABLE ... CLUSTER BY without rewriting history. |
| `ENCODE AUTO / ZSTD / AZ64` | Explicit per-column compression codecs chosen at CREATE TABLE time. | Native Parquet Dictionary / RLE / ZSTD | Automatic per-column compression inside .parquet files—zero manual ANALYZE COMPRESSION runs! |
| `VACUUM DELETE ONLY` | Reclaimed empty disk space inside fixed node SSDs after DELETE/UPDATE. | `OPTIMIZE` (compaction) + `VACUUM RETAIN 168 HOURS` | OPTIMIZE merges small files for read speed; VACUUM cleans aged cloud storage snapshots safely. |
| Schema / Grant ACLs | Local cluster users, schemas, and GRANT statements per cluster. | Unity Catalog (3-Level Namespace) | Centralized permissions (catalog.schema.table), column masking & automated lineage across all workspaces! |
CREATE TABLE public.sales (
salesid INTEGER NOT NULL DISTKEY,
listid INTEGER NOT NULL,
sellerid INTEGER ENCODE AZ64,
eventid INTEGER ENCODE AZ64,
qtysold SMALLINT ENCODE AZ64,
pricepaid DECIMAL(8,2) ENCODE AZ64,
saletime TIMESTAMP SORTKEY
);CREATE TABLE tickit_prod.gold.fact_sales (
sales_id BIGINT NOT NULL,
listing_id BIGINT NOT NULL,
seller_id BIGINT NOT NULL,
event_id BIGINT NOT NULL,
qty_sold INT NOT NULL,
price_paid DECIMAL(18, 2) NOT NULL,
sale_timestamp TIMESTAMP NOT NULL
)
USING DELTA
CLUSTER BY (event_id, sale_timestamp)
TBLPROPERTIES (
'delta.enableChangeDataFeed' = 'true',
'quality.owner' = 'marketplace-analytics'
);Look closely at two upgrades in the modern table:
1. `DECIMAL(18, 2)` precision headroom: Avoids Redshift overflow bugs during large SUM(price_paid) rollups.
2. `delta.enableChangeDataFeed = true` (`CDF`): Records row-level _change_type (insert, update_preimage, update_postimage, delete) inside _change_data so downstream consumers process only incremental changes instead of re-reading terabytes daily!
-- Reading ONLY rows inserted/updated between Delta version 10 and 15 via CDF:
SELECT sales_id, price_paid, _change_type, _commit_timestamp
FROM table_changes('tickit_prod.gold.fact_sales', 10, 15);TIMESTAMP_NTZ only when explicit wall-clock local time is intended) so global sales reconcile cleanly across regions.Test your understanding of the concepts covered in this lesson.
Auditors require a full record of all historical price edits and commission changes made in the marketplace. We query Delta Lake's Change Data Feed (CDF) to see every insert, update pre-image, and update post-image.