Skip to main content
Back to Academy⚡ 4. Lakehouse Engineering & Delta Architecture
5 min read
Try Hands-on Lab
VISUAL LESSON4. Lakehouse Engineering & Delta Architecture

Migrating Redshift TICKIT to a Governed Delta Lakehouse

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).

Redshift to Databricks MigrationDISTKEY vs Liquid ClusteringSORTKEY vs Data SkippingDelta Change Data Feed CDFUnity Catalog GovernanceRedshift ENCODE vs Parquet Compression

Explain Like I'm New: Fixed Highway Lanes vs. Self-Driving Object Storage

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!

Key Beginner Takeaway: Redshift `DISTKEY + SORTKEY` -> Delta `CLUSTER BY` (Liquid Clustering); Redshift `ENCODE` -> Automatic Parquet Encoding; Redshift **STL_* audit logs -> Unity Catalog System Tables & Delta History**.

Complete Concept Translation Cheatsheet (Redshift -> Delta Lakehouse)

Classic Redshift ConceptWhat It Did in RedshiftModern Delta Lakehouse EquivalentWhy 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 + AQEDecoupled 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 StatsDelta 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 / ZSTDAutomatic 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 ACLsLocal 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!

Step-by-Step DDL Migration Example (Redshift -> Delta Lake)

Legacy Redshift DDL

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
);

Modern Governed Delta Lake DDL (Unity Catalog + Liquid Clustering + CDF)

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);

Common Migration Pitfalls (And How to Fix Them)

  1. Copying Redshift `DISTSTYLE ALL` blindly: In Redshift you duplicated small dimensions onto every node; in Spark/Lakehouse, AQE Broadcast Join handles small-dimension replication automatically in RAM—no special DDL needed!
  2. Translating Redshift `VARCHAR(MAX)` or `TIMESTAMP` timezone mismatches naively: Always standardize timestamps to `TIMESTAMP` (UTC) (TIMESTAMP_NTZ only when explicit wall-clock local time is intended) so global sales reconcile cleanly across regions.
  3. Keeping legacy `PARTITIONED BY (year, month, day, hour)` habits: Replace granular multi-folder partitions with clean Liquid Clustering (`CLUSTER BY`) so tiny hourly files don't choke cloud object storage!

Quick Cheat Sheet

  1. Replace Redshift `DISTKEY` + `SORTKEY` with Delta `CLUSTER BY` (Liquid Clustering).
  2. Remove manual `ENCODE` clauses—Parquet handles dictionary & ZSTD compression automatically.
  3. Enable Change Data Feed (`delta.enableChangeDataFeed = 'true'`) for cheap incremental downstream pipelines.
  4. Centralize tables in Unity Catalog (`catalog.schema.table`) for unified governance and cross-team lineage.

Comprehension & Architecture Check (3 Questions)

Test your understanding of the concepts covered in this lesson.

1. What Delta Lake feature replaces Redshift DISTKEY and SORTKEY for multi-dimensional data co-location?
2. Why should beginners check a table's grain before writing a JOIN?
3. Which Medallion layer is meant to store clean, deduplicated, standardized records?
Practice What You Learned

TICKIT-09: Gold Marts, Time Travel and CDF

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.

Solve Challenge