dim_time
PK time_keydate · month · quarter1DATA SYSTEMS · INTERACTIVE LAB
The useful question is not “which database wins?” It is “what work did the system avoid, defer, store or repeat?”
34-SLIDE TEACHING DECK
Begin with the conceptual journey before running the laboratories: VIEW, materialization, row versus column storage, incremental view maintenance, and the physical choices behind modern OLAP.
CONCEPTUAL ER DIAGRAM
Each dimension describes many sale events. The laboratories intentionally embed these attributes in sales so every engine receives one portable physical contract.
PK time_keydate · month · quarter1PK product_keycategory · product1PK customer_idcustomer attributes1PK geography_keyregion · province1PK channel_keychannel1PK sale_idFK time · product · customerFK geography · channelquantity · unit_price · discountrevenue · cost · profitNONE QUESTION · THREE COMPUTATION PLACEMENTS
THREE LABS · THREE DIFFERENT NEEDS
COMMON DATA CONTRACT
A fair comparison needs more than similar column names. Every engine receives the same row meaning, deterministic values, measures and analytical question. Storage types change only where an engine requires its native equivalent.
sale_id · BIGINT / UInt64sale_timestamp · TIMESTAMP / DateTimeregion · provincecategory · productchannel · customer_idquantity · unit_price · discountrevenue · cost · profitRegion, category and channel mean the same thing in every lab; performance cannot be “won” by silently changing the question.
The baseline groups sales by region and category and computes order count and revenue. Engine-specific experiments then reveal their strengths.
No student or production record is used. Deterministic formulas make every reset reproducible.
This is intentionally a compact teaching schema, not a full enterprise model. In production, customer, product and geography commonly become governed dimensions with explicit history, quality and privacy rules.
MASTER COMPARISON
| System | Computation location | Physical reuse | Freshness model | Best teaching question |
|---|---|---|---|---|
| PostgreSQL | database server | materialized rows | explicit refresh | logic vs stored result |
| DuckDB | web process | Parquet + local table | file/table replacement | serverless analytical scan |
| ClickHouse | isolated OLAP server | sorted column parts + aggregate states | new inserted blocks | layout and incremental work |