RDBMS Schemas

The list above names the schema patterns. The sections below show how they relate, which workload each suits, and example SQL for the main dimensional shapes.

The following are common database schemas used in relational database management systems (RDBMS), including the Star Schema, from which the Snowflake Schema is derived:

  1. Star Schema:
  2. Snowflake Schema:
  3. Galaxy Schema (Fact Constellation Schema):
  4. Hierarchical Schema:
  5. Network Schema:
  6. Flat Schema:

These schemas are utilized based on the specific needs of the database structure, data integrity, and query complexity.

1. How the Patterns Relate

Schema Patterns Compared Star fact + flat dimensions 3NF / OLTP normalized entities Snowflake normalized dimensions Data Vault hubs, links, satellites Galaxy many facts, shared dims Wide table denormalized, one table Top row: dimensional (analytics). Bottom row: other common modeling styles.

Schema patterns fall into two families. Transactional systems use normalized designs, usually third normal form, so that each fact is stored once and inserts and updates touch few rows. Analytical systems use dimensional designs, where data is shaped around business processes and the questions people ask. The star schema is the base dimensional pattern: one fact table joined to denormalized dimensions. A snowflake schema normalizes dimension hierarchies into separate tables. A galaxy, or fact constellation, schema has several fact tables that share conformed dimensions such as date and customer, so sales and inventory can be compared on the same keys.

2. Where Each Pattern Is Used

Typical Layering in a Warehouse Sources OLTP in 3NF Staging raw copies Integration Data Vault or 3NF Marts star / snowflake BI dashboards, SQL

A single organization usually uses several of these at once. Source applications stay in third normal form. A warehouse may land raw data in staging tables, integrate it in a normalized or Data Vault layer that tracks history and lineage, and then publish star schemas as data marts for reporting. Wide denormalized tables are sometimes built on top of marts for a single dashboard or machine learning feature set.

The choice between the patterns comes down to the workload. Normalization optimizes for correctness under frequent small writes: an address changes in one row, and every order sees the new value through a join. Dimensional modeling optimizes for reads by many people asking aggregate questions: data is loaded in batches by controlled pipelines, so redundancy is managed by the load process rather than by constraints. Columnar warehouses have narrowed the performance gap for joins, which is why snowflaked dimensions and even wide tables are more acceptable today than in row-oriented systems, but the clarity a star schema gives to business users remains its main advantage.

3. When to Use Which

PatternStrengthWeaknessUse for
3NFNo redundancy, safe updatesMany joins for analyticsOLTP applications
StarSimple joins, BI-friendlyRedundant dimension attributesData marts, reporting
SnowflakeLess redundancy, clear hierarchiesMore joinsLarge shared hierarchies
GalaxyCross-process analysisRequires conformed dimensionsEnterprise warehouses
Data VaultAuditable history, easy to extendNot query-friendly directlyIntegration layer
Wide tableNo joinsDuplication, hard to maintainSingle-purpose outputs

4. Worked Example: Galaxy Query Across Two Facts

-- Two fact tables sharing conformed dim_date and dim_product
WITH sales AS (
  SELECT d.month_key, f.product_key, SUM(f.quantity) AS units_sold
  FROM fact_sales f JOIN dim_date d ON f.date_key = d.date_key
  GROUP BY d.month_key, f.product_key
),
stock AS (
  SELECT d.month_key, i.product_key, AVG(i.on_hand) AS avg_on_hand
  FROM fact_inventory i JOIN dim_date d ON i.date_key = d.date_key
  GROUP BY d.month_key, i.product_key
)
SELECT p.category, s.month_key,
       SUM(s.units_sold)  AS units_sold,
       SUM(k.avg_on_hand) AS avg_on_hand
FROM sales s
JOIN stock k        ON k.month_key = s.month_key AND k.product_key = s.product_key
JOIN dim_product p  ON p.product_key = s.product_key
GROUP BY p.category, s.month_key;

Each fact is aggregated to a common grain before joining. Joining two fact tables directly at their native grain multiplies rows and inflates the sums, a mistake often called a fan trap.

5. Pitfalls

Whatever pattern you pick, document the grain and keys of every table; that documentation prevents most of the problems listed above.