CLOUD CONCEPT

Star Schema

A star schema is an analytical data model that connects a central fact table to descriptive dimension tables through keys.

Cloud Concepts Hub →

What is Star Schema

Fact tables record business events or measurements at a defined level of detail, while dimension tables provide attributes used to filter, group, and interpret those facts. This structure makes analytical queries easier to understand and supports consistent reporting, but requires careful handling of historical changes, joins, and data quality.

A star schema organizes analytical data around a business process, such as sales, shipments, or payments. A central fact table contains measurements and keys referencing surrounding dimension tables. The dimensions describe entities such as customers, products, stores, and dates. Unlike a highly normalized transactional model, a star typically keeps descriptive hierarchies together in each dimension, reducing the joins needed for common reports.

Start by defining the grain: exactly what one fact row represents. For a retail model, one row might represent one product line on one completed order. The fact table could contain order identifier, customer key, product key, sale-date key, quantity, and net sales amount. Product category and brand belong in the product dimension. Mixing order-level totals with line-level measurements in the same fact table can produce double counting. Measures also need explicit aggregation rules: sales amounts can usually be summed, but percentages should generally be calculated from aggregated numerators and denominators.

Dimension keys commonly use warehouse-generated surrogate identifiers rather than operational business identifiers. This separates analytical identity from source-system changes and supports historical versions. With a slowly changing dimension Type 2 approach, a customer's region change creates a new dimension row with a new surrogate key and validity dates. Each fact references the version applicable to its event time. Type 1 instead overwrites the attribute, which is appropriate when historical values need not be preserved. Load processes must handle late-arriving records and ensure that joins do not accidentally match multiple dimension versions.

In a cloud data warehouse such as Amazon Redshift, the star is implemented as tables queried with SQL joins and aggregations. Physical design remains important: distribution choices affect data movement, sort keys can support selective filtering, and statistics help the optimizer. Replicating a small dimension with an ALL distribution style can reduce join redistribution, but increases storage and maintenance work. Automatic table optimization is another option. Redshift primary-key and foreign-key declarations are informational rather than enforced, so pipelines must validate uniqueness and referential integrity before relying on those declarations.

A data lake can also hold fact and dimension tables, for example as Parquet datasets or Apache Iceberg tables on Amazon S3. AWS Glue Data Catalog records table metadata, and Amazon Athena can query the tables. AWS Lake Formation governs access to supported cataloged resources; it does not create the star model, enforce its relationships, or replace a query engine. Partitioning a large fact dataset by a commonly filtered date can reduce scanned data, whereas excessive partitioning can introduce metadata and small-file overhead.

Amazon DynamoDB requires a different modeling decision. It does not provide server-side relational joins, so directly copying separate fact and dimension tables into DynamoDB is generally unsuitable for ad hoc star-schema analytics. Design DynamoDB keys, indexes, and denormalized items around application access patterns. When analytical joins are required, export or replicate the relevant operational data into a warehouse or lake and construct the star there.

Schema evolution must preserve the grain and meaning of existing data. Adding an optional dimension attribute or a new measure can be compatible, but existing records still need defined null or default semantics. Changing a measurement's unit, redefining a business key, or moving from order grain to line-item grain requires an explicit migration plan, often involving new tables or versioned views. Coordinate catalog metadata, transformations, consumer queries, and access policies when schemas change.

The main trade-off is simpler analytical querying in exchange for transformation work and repeated descriptive attributes. A star is not the same as one completely flattened table, and it is not automatically faster for every workload. Snowflaking normalizes dimensions into additional related tables, trading reduced redundancy for more joins. Choose the model using query patterns, historical reporting requirements, data volume, and maintenance cost rather than assuming that every cloud database should use a star.

Key aspects of Star Schema

A reliable star schema combines a consistent fact grain, descriptive dimensions, controlled history, validated relationships, and workload-appropriate storage design.

Explicit fact-table grain

Define precisely what each fact row represents before selecting measures or keys. Keep measurements at compatible grains to prevent incorrect totals.

Fact-to-dimension relationships

Store measurements and dimension references in facts, and descriptive attributes in dimensions. Validate dimension-key uniqueness so joins do not multiply fact rows.

Denormalized dimensions

Keep frequently used descriptive hierarchies, such as product category and brand, together in a dimension. This simplifies reporting queries while accepting some attribute repetition.

Historical dimension handling

Use explicit policies for attribute changes, such as Type 1 overwrites or Type 2 versioned rows. For Type 2, resolve facts to the correct historical surrogate key.

Workload-aware physical design

Adapt distribution, sorting, file layout, and partitioning to the query engine and access patterns. A logical star alone does not guarantee efficient execution.

Controlled schema evolution

Treat grain changes and measurement redefinitions as model changes, not merely column edits. Coordinate migrations with data backfills, validation, metadata updates, and downstream consumers.

Cloud services for Star Schema

Operational records from DynamoDB and other sources can be transformed with AWS Glue into fact and dimension datasets. These datasets can reside in Amazon Redshift for warehouse analytics or on Amazon S3 for lake-based querying with Athena. AWS Glue Data Catalog describes lake tables, while Lake Formation governs access through supported integrations. The same logical model can serve both environments, but physical design differs: warehouse distribution and sorting address different execution concerns from lake partitioning and file layout. Pipelines remain responsible for grain consistency, historical key resolution, and relationship validation.

Amazon Redshift image Amazon Redshift

Implements star schemas with fact and dimension tables for SQL analytics. Distribution styles, sort keys, and statistics affect join performance, while ingestion pipelines must enforce the integrity of declared primary and foreign keys.

Open Amazon Redshift →
AWS Lake Formation image AWS Lake Formation

Governs access to cataloged fact and dimension data in a data lake through supported service integrations. It manages permissions rather than designing schemas, executing analytical joins, or enforcing referential integrity.

Open AWS Lake Formation →
AWS Glue image AWS Glue

Provides data integration capabilities for building fact and dimension datasets, including key resolution and historical transformations. Its Data Catalog stores table metadata, but cataloging alone does not validate star-schema relationships.

Open AWS Glue →
Amazon Simple Storage Service image Amazon S3

Stores lake-based fact and dimension datasets in formats such as Parquet or in table layouts managed by Apache Iceberg. File sizing and partition design influence the efficiency of engines querying those datasets.

Open Amazon S3 →
Amazon Athena image Amazon Athena

Executes SQL joins and aggregations over lake-based fact and dimension tables. Columnar storage, selective filters, and suitable partitioning help control scanned data and query cost.

Open Amazon Athena →
Amazon DynamoDB image Amazon DynamoDB

Commonly supplies operational data that is transformed into an analytical star elsewhere. Its application data models should follow access patterns rather than assume relational joins between separate fact and dimension tables.

Open Amazon DynamoDB →