Contents

Chapter 1

What's inside

This chapter covers the core features and capabilities of Data Modeling Patterns.

What's inside

  • 9 runnable SQL files — dimensional models, all the SCD types, audit columns,

soft delete, partitioning, a full normalization walk-through, and a complete

worked e-commerce schema.

  • 6 decision guides — each with quick-reference tables, an explicit decision

tree, and an FAQ, so you can choose correctly under time pressure.

  • A worked example — one coherent e-commerce OLTP schema with an

entity-relationship diagram and design rationale that ties every pattern together.

All SQL is PostgreSQL syntax with notes where other engines differ. No external

dependencies — you need only a database to run it against (or just read it).

Quick start

1. Unzip the product.

2. Skim this README, then open examples/ecommerce-er-diagram.md

for the big picture.

3. Run a pattern against a scratch database, e.g.:

bash
   psql "postgres://localhost/scratch" -f sql/normalization-examples.sql
   psql "postgres://localhost/scratch" -f sql/scd-type2.sql
   psql "postgres://localhost/scratch" -f examples/ecommerce-model.sql

Each file is self-contained: it creates its own schema, seeds demo data, and

ends with verification queries (commented) you can run to see the result.

4. Read the matching guide in docs/ for the *why* and the decision rules.

The SQL files create schemas named dw, app, norm, and shop. Run them on

a throwaway database so they never touch anything real.

Chapter 2

File-by-file guide

Follow this guide to get Data Modeling Patterns up and running in your environment.

File-by-file guide

sql/ — runnable patterns

FilePatternWhat it teaches
star-schema.sqlStar dimensional modelFact + denormalized dimensions, grain, surrogate keys, a date dimension
snowflake-schema.sqlSnowflake dimensional modelNormalized dimension hierarchies and when they earn their keep
scd-type2.sqlSlowly Changing Dimension, Type 2Full history: validity windows, current flag, correct fact joins
scd-type1-3.sqlSCD Types 1 & 3Overwrite vs keep-previous-value, chosen per column
audit-columns.sqlAudit columnscreated/updated bookkeeping, a tamper-proof trigger, full audit log
soft-delete.sqlSoft deletedeleted_at marker, a safety-net view, partial unique indexes, purge job
partitioning.sqlTable partitioningRANGE / LIST / HASH strategies, pruning, instant retention
normalization-examples.sqlNormalizationOne messy table walked from unnormalized → 1NF → 2NF → 3NF

docs/ — decision guides

FileAnswers
normalization-vs-denormalization.mdWhen to normalize, when to denormalize, and how to stay correct
indexing-strategy.mdWhat to index, composite column order, why an index gets ignored
scd-types.mdWhich SCD type per attribute, and the Type 2 mechanics that trip people up
star-vs-snowflake.mdStar vs snowflake, grain, and which to default to
partitioning-guide.mdWhen partitioning actually helps (and when it just adds complexity)
anti-patterns.md12 common schema mistakes and what to do instead

examples/ — a complete worked model

FileContents
ecommerce-model.sqlA full e-commerce OLTP schema applying every pattern in context
ecommerce-er-diagram.mdER diagram, cardinalities, design rationale, access patterns

How to use this product

Designing a new schema? Start with anti-patterns.md

(know what to avoid), then normalization-vs-denormalization.md

to set your target normal form, then build with

ecommerce-model.sql as a template.

Building a warehouse / reporting layer? Read

star-vs-snowflake.md, model with

star-schema.sql, and handle changing dimensions with

scd-types.md + scd-type2.sql.

Performance problem on an existing schema? Go straight to

indexing-strategy.md, and consider

partitioning-guide.md if the table is large with a

date/lifecycle pattern.

Chapter 3
🔒 Available in full product

FAQ

Chapter 4
🔒 Available in full product

Support

You’ve reached the end of the free preview

Get the full Data Modeling Patterns and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $29 →
📦 Free sample included — download another copy for the full product.
Data Modeling Patterns v1.0.0 — Free Preview