What is a fact constellation (galaxy) schema, and when does a model become one?
answer
- how many fact tables are in the picture?
- what do the stars have in common?
- what happens on the second business process?
- joining fact to fact does what to totals?
- dimensions must mean the same thing to both
basics
~20 sA fact constellation, also called a galaxy schema, is several fact tables sharing the same dimension tables. Models become one as soon as a second business process is added — sales and inventory both pointing at the same date and product dimensions.
solid answer
~50 sA single star covers one business process at one grain. Add a second process — inventory alongside sales, shipments alongside orders — and you get a second fact table that reuses the existing date, product and store dimensions rather than duplicating them. Multiple stars sharing dimension tables is what the literature calls a **fact constellation** or **galaxy schema**. It is not an exotic design; it is what any warehouse looks like after its second subject area. Two rules keep it honest. The shared dimensions must genuinely mean the same thing to every fact that uses them, otherwise the same filter yields different populations in different reports. And you never join two fact tables directly to each other through a shared dimension key: the join fans out rows and inflates measures on both sides. Facts are combined by aggregating each to a common set of dimension keys first, which is the drill-across pattern.
go deeper
Recognize the term: several fact tables sharing the same dimension tables, which is simply what a warehouse looks like once it covers a second business process.
Explain why dimensions are shared rather than copied, and state the hard rule that fact tables are combined through shared dimensions, never by joining fact to fact.
Be ready to diagnose an inflated report caused by a direct fact-to-fact join and to say what common dimensionality two differently-grained facts can actually be compared at.
Own the consequence at platform scale: a constellation only pays off if shared dimensions mean the same thing everywhere, which is a governance commitment across teams, not a table-reuse convenience.
## Definition A **fact constellation**, also known as a **galaxy schema**, is a dimensional model containing more than one fact table where those fact tables share dimension tables. Diagrammatically it is several stars overlapping at their dimension points, which is where the galaxy metaphor comes from. It is the normal end-state of any warehouse that covers more than one business process, not a special technique you choose to adopt. ```text dim_date dim_product dim_store | \ / \ / | | \ / \ / | fact_sales ----+ +---- fact_inventory (one row per (shared dimensions) (one row per sale line) product/store/day) ``` ## How a model gets there Start with a sales star: `fact_sales` at one row per sale line, joined to date, product, store and customer dimensions. Now the business asks about stock cover. Inventory is a different process measured at a different grain — one row per product, store and day — so it needs its own fact table. What it does *not* need is its own copy of the date, product and store dimensions. Reusing them gives you a constellation and, more importantly, gives you dimensions whose members and attribute values are identical across both subject areas. ## The condition that makes it work Sharing a dimension table is only valuable if the dimension means the same thing to each fact. If `dim_store` in the sales context silently excludes closed stores but inventory expects all of them, a filter on region returns two different store populations depending on which fact you queried, and the two reports will never reconcile. Ensuring shared dimensions carry identical keys and identical attribute meanings across processes is the discipline of conformance, and it is what makes a constellation more than a coincidence of table reuse. ## The trap: never join two fact tables directly This is the practical point interviewers probe. Two facts sharing `dim_product` invites a query like this: ```sql -- WRONG: joining two fact tables on a shared key multiplies rows SELECT p.category_name, SUM(s.net_amount) AS revenue, SUM(i.on_hand_qty) AS stock FROM fact_sales s JOIN fact_inventory i ON i.product_key = s.product_key JOIN dim_product p ON p.product_key = s.product_key GROUP BY p.category_name; ``` The join is a many-to-many between two fact tables. Every sale row pairs with every inventory row for that product, so a product with 50 sales and 365 daily inventory rows produces 18,250 combinations. Revenue is inflated by the number of inventory rows and stock by the number of sales rows, and both numbers are nonsense. Nothing errors; the query just lies. The correct approach is to aggregate each fact independently to the same set of dimension keys and combine the two summarized result sets on those keys — the drill-across pattern, which is a subject in its own right. The modelling takeaway that belongs here is structural: **fact tables relate to each other only through shared dimensions, never by joining to each other**. ## Grain differences between the facts The two facts in a constellation usually sit at different grains — a transaction fact per event, a snapshot fact per day. That is expected and fine. It only means the common ground on which you can combine them is the coarsest set of dimensions and levels both facts support. If sales are captured per store and inventory only per distribution centre, there is no store-level comparison to be made no matter how you write the query. ## Is it a distinct schema type? Somewhat academically. Textbooks list star, snowflake and fact constellation as three schema types, and interviewers who learned from those textbooks will ask for the third name. In working practice, a constellation is simply what a bus-matrix-driven warehouse produces: rows of business processes, columns of shared dimensions, and a fact table wherever a process needs one. Be able to define the term, place it correctly, and immediately say the two things that matter — dimensions must conform, and facts are never joined to facts. ## Contrast with the snowflake Do not confuse the axes. Star versus snowflake is about the *shape of a dimension*: one wide table or a normalized chain. Constellation is about the *number of fact tables* sharing dimensions. They are independent: a constellation's dimensions can be flat or snowflaked, and either choice leaves it a constellation.
- Why does joining two fact tables on a shared dimension key inflate the totals?The relationship between them is many-to-many. Every row on one side pairs with every matching row on the other, so a product with 50 sales and 365 inventory rows yields 18,250 combinations. Each side's measure is then summed once per row on the opposite side, and both totals become meaningless multiples.
- Do the fact tables in a constellation have to share the same grain?No, and they usually do not — a transaction fact and a daily snapshot fact coexist happily. The consequence is that they can only be compared at the coarsest dimensionality both support. If one is captured per store and the other per region, store-level comparison simply does not exist.
- Is a fact constellation compatible with snowflaked dimensions?Yes. The two ideas sit on different axes: constellation counts fact tables sharing dimensions, while star versus snowflake describes whether a single dimension is one wide table or a normalized chain. A constellation's shared dimensions can take either shape without changing what it is called.
Several stars sharing their points: each business process has its own fact at the centre, but the surrounding dimension tables are the same objects seen from more than one star.
saying these in an interview costs you the question
- Thinks a galaxy schema means multiple copies of the dimensions
- Joins two fact tables directly on a shared dimension key
- Confuses constellation with snowflake as if they were the same axis
- Assumes both fact tables must share the same grain
- Believes sharing a dimension table alone guarantees consistent meaning