Data Warehousing 教程
Data warehousing tutorial: OLTP and OLAP, architecture, dimensional modeling, facts and dimensions, slowly changing dimensions, ELT, performance and governance.
Getting Started
- What Is a Data Warehouse? Learn what a data warehouse is, why organizations build one, who works with it, what you need to know first, and how this tutorial is organized.
- OLTP vs OLAP: Two Kinds of Database Work Compare OLTP and OLAP workloads: transactions against analysis, normalized against dimensional design, row against column storage, with runnable SQL.
Architecture
- Warehouse Layers: Staging, Core and Marts Understand data warehouse architecture: sources, landing and staging, the integrated core, data marts and the access layer, with a runnable SQL walkthrough.
- Inmon, Kimball and Data Vault Compare the Inmon, Kimball and Data Vault approaches to warehouse design, see how hubs, links and satellites work, and learn how to choose and combine them.
- Cloud Warehouses, Data Lakes and Lakehouses Learn how cloud data warehouses work, including parallel processing and separate storage and compute, and how they compare with data lakes and lakehouses.
Dimensional Modeling
- The Dimensional Design Process Design a dimensional model in four steps: choose the business process, declare the grain, identify dimensions and identify facts, with runnable SQL checks.
- Star and Snowflake Schemas Build a star schema in SQL, compare it with a snowflake schema, learn about galaxy schemas and wide tables, and write the standard star-join query.
- Conformed Dimensions and the Bus Matrix Learn how conformed dimensions let you combine fact tables safely, how to plan with a bus matrix, and how to drill across two stars in SQL.
Facts and Dimensions
- Fact Table Types Understand transaction, periodic snapshot, accumulating snapshot and factless fact tables, when to use each, and how to query them with runnable SQL.
- Measures and Additivity Learn which measures you can safely sum: additive, semi-additive and non-additive facts, how to compute ratios and averages, and how to treat NULLs.
- Dimension Tables and Surrogate Keys Design useful dimension tables with surrogate and natural keys, hierarchies and unknown rows, and generate a date dimension with a runnable SQL query.
- Special Dimension Patterns Learn role-playing, degenerate, junk, outrigger and mini-dimensions, plus bridge tables for many-to-many relationships, with runnable SQL examples.
History and Slowly Changing Dimensions
- Slowly Changing Dimension Types Compare slowly changing dimension types 0 to 4 and 6, see how overwrite and add-row choices change report results, and learn how to choose per attribute.
- SCD Type 2 in SQL Implement SCD Type 2 in SQL step by step: detect changes, close old versions, insert new ones, run point-in-time joins and test for overlaps and gaps.
Loading Data
- ETL and ELT Compare ETL and ELT, learn the steps of a warehouse load, route bad rows to a reject table, order dimension and fact jobs, and make pipelines repeatable.
- Incremental Loads and Change Data Capture Load only what changed: watermarks with lookback windows, upserts, deletes, change data capture, and applying a change feed safely in runnable SQL.
- Loading Fact Tables Load fact tables correctly: look up surrogate keys, handle late-arriving dimensions and facts, rerun a day safely and understand how MERGE fits in.
Querying and Performance
- Analytical SQL for Warehouses Query a warehouse with analytical SQL: subtotals with ROLLUP and CUBE, window functions, period comparisons, shares of total and OLAP operations.
- Partitioning, Clustering and Columnar Performance Speed up warehouse queries by reading less data: columnar storage, compression, partition pruning, clustering, join habits, indexes and query plans.
- Materialized Views and Aggregate Tables Use views, materialized views and aggregate tables wisely: refresh strategies, incremental refresh with late data, additive designs and reconciliation.
Operations, Quality and Governance
- Data Quality and Reconciliation Protect trust in your warehouse with quality dimensions, SQL tests, source reconciliation, freshness and volume monitoring, and a clear incident process.
- Metadata, Lineage and Semantic Layers Document your warehouse with metadata, data catalogs and lineage, trace impact with a recursive SQL query, and define shared metrics in a semantic layer.
- Security, Governance and Cost Protect and run a warehouse: least privilege, row and column controls, masking, retention, auditing, governance roles, change management and cost control.
Projects and Reference
- Project: Build a Retail Sales Warehouse Build a retail sales warehouse end to end in SQL: design the grain, create dimensions and facts from raw data, reconcile totals and answer questions.
- Project: Track Customer History Build a customer history pipeline in SQL: process daily snapshots into an SCD Type 2 dimension, handle deletes and returns, load sales and test results.
- Data Warehousing Glossary and Cheat Sheet A quick reference for data warehousing: key terms, the design checklist, fact and SCD types, additivity rules and reusable SQL patterns.