Fact constellation schema
A fact constellation schema (also called a galaxy schema) is a dimensional model with multiple fact tables that share one or more common dimension tables.
Overview
A fact constellation — sometimes called a galaxy schema — extends the star schema to the reality that most real warehouses need more than one fact table. Instead of one star, you have several fact tables, each with its own set of dimensions, some of which are shared (conformed) across fact tables. Visualized, multiple stars overlap where they share dimension tables, resembling a constellation.
For example, a retail warehouse might have fact_sales and fact_inventory, both sharing dim_date, dim_product, and dim_store, while each also has dimensions unique to its own process (fact_sales might have dim_customer; fact_inventory might have dim_warehouse_location).
Example
Copy code
CREATE TABLE dim_date (date_key INTEGER PRIMARY KEY, full_date DATE);
CREATE TABLE dim_product (product_key INTEGER PRIMARY KEY, product_name VARCHAR);
CREATE TABLE dim_store (store_key INTEGER PRIMARY KEY, store_name VARCHAR);
CREATE TABLE fact_sales (
date_key INTEGER REFERENCES dim_date(date_key),
product_key INTEGER REFERENCES dim_product(product_key),
store_key INTEGER REFERENCES dim_store(store_key),
revenue DECIMAL(12,2)
);
CREATE TABLE fact_inventory (
date_key INTEGER REFERENCES dim_date(date_key),
product_key INTEGER REFERENCES dim_product(product_key),
store_key INTEGER REFERENCES dim_store(store_key),
units_on_hand INTEGER
);
-- Compare sales against inventory using the shared dimensions
SELECT d.full_date, p.product_name, s.revenue, i.units_on_hand
FROM fact_sales s
JOIN fact_inventory i USING (date_key, product_key, store_key)
JOIN dim_date d USING (date_key)
JOIN dim_product p USING (product_key);
A fact constellation is really just what Kimball's bus architecture produces at scale: as a warehouse grows to cover more business processes, it naturally accumulates multiple fact tables that conform to a shared set of dimensions, rather than existing as a single, isolated star.
DuckDB angle
There's nothing special DuckDB needs for a fact constellation — it's the same tables and joins as a single star schema, just more of them — though joining two fact tables directly (as above) only works cleanly when they share the same grain on the join keys; otherwise, aggregate each to a common grain before joining.
Related terms
A fact table is the central table in a dimensional model that stores numeric measures (like revenue or quantity) alongside foreign keys linking to descriptive dimension tables.
Conformed dimension →A conformed dimension is a dimension table — like a shared date or customer dimension — that is defined identically and reused across multiple fact tables or data marts, so metrics stay comparable across the warehouse.
Star schema →A star schema is a dimensional data warehouse design where a central fact table of numeric measures connects directly to denormalized dimension tables, forming a shape like a star.
Dimension table →A dimension table stores the descriptive, mostly-textual attributes — like customer name, product category, or region — that you use to filter, group, and label the measures in a fact table.
Dimensional modeling →Dimensional modeling is a data warehouse design methodology, developed by Ralph Kimball, that organizes data into fact tables (measures) and dimension tables (descriptive context) optimized for business-user querying.
Snowflake schema →A snowflake schema is a dimensional model where dimension tables are normalized into multiple related sub-tables instead of one flat table, reducing redundancy at the cost of extra joins.
FAQS
A star schema has a single fact table at its center. A fact constellation (galaxy schema) has multiple fact tables, which share one or more common dimension tables between them.
