Star schema keeps dimensions denormalized for speed, while snowflake normalizes them for space and consistency.
A star schema stores a central fact table surrounded by denormalized dimension tables. Each dimension connects to the fact table with a single primary-to-foreign key, resulting in fewer joins and faster scans.
A snowflake schema starts with the same fact table but normalizes each dimension into multiple related tables. This saves storage and enforces data integrity but adds joins.
Choose a star schema when query speed is critical, the dataset fits in memory, and dimensions rarely change. Oracle’s bitmap indexes, materialized views, and partition pruning thrive on the flatter layout.
Pick a snowflake schema when many dimensions share hierarchies (e.g., Country → State → City) or when dimension data changes frequently. Normalization prevents update anomalies and reduces redundant storage.
Star schemas require fewer joins, so OLAP queries like SUM(total_amount) by product and month run faster. Snowflake schemas may need 3–4 joins per dimension and depend on optimizer statistics, indexes, and join elimination.
Star: Orders_Fact joins directly to Customers_Dim, Products_Dim, and Date_Dim.
Snowflake: Orders_Fact joins to Customers_Dim → Geography_Dim and Products_Dim → Category_Dim.
Yes—hybrid schemas keep high-cardinality or volatile dimensions snowflaked while leaving stable dimensions denormalized.
Use surrogate keys instead of business keys. Partition large fact tables. Add bitmap indexes on low-cardinality columns. Refresh optimizer statistics regularly.
-- Star-style dimension
CREATE TABLE Products_Dim (
product_key NUMBER PRIMARY KEY,
name VARCHAR2(100),
category VARCHAR2(50),
price NUMBER(10,2),
stock NUMBER
);
-- Snowflake extension
CREATE TABLE Categories_Dim (
category_key NUMBER PRIMARY KEY,
category VARCHAR2(50)
);
ALTER TABLE Products_Dim ADD CONSTRAINT fk_cat
FOREIGN KEY (category) REFERENCES Categories_Dim(category);
It usually is for scan-heavy analytics because it minimizes joins, but index tuning can make snowflake designs competitive.
Yes, if you have large hierarchies with repeating text values. If not, compression may negate the benefit.
Yes. Use views or materialized views to hide physical changes from BI tools while you migrate.