Levels of Aggregation

Context: FIT3003_MOC Β· the ladder of star schemas over ONE subject β€” how far the fact measure has been rolled up, and how to push it back down βž” Star Schema, Identifying a Level-0 Star Schema, Fact Constellation Parent Framework: Data Warehouse

Quick Revision

  • 🎯 Objective: a warehouse is precomputed aggregate values βž” keep the same subject at several granularities, (no aggregation, most detail) up to (most aggregated), so management can drill down by querying the level below.
  • πŸ“¦ Core Components: add a new dimension βž” breaks each measure value across the new dimension’s members | replace a dimension with a higher-granularity one βž” breaks it across finer members of the same axis.
  • ⚑ Key Constraint: given a star schema you can only decide Level-0 or not β€” any other number depends on how many non-Level-0 schemas sit beneath it, so the numbering is a property of the architecture, never of one diagram.

πŸ“ How It Works

1. Granularity and aggregation are inverse

  • Level-0 definition βž” highest granularity, no aggregation: all domain tables are incorporated as dimension tables and no grouping exists in the dimension attributes.
  • Inverse pairing βž” lower granularity higher aggregation higher level number; because warehousing is about aggregates, the ladder is named Level of Aggregation.
  • Only one rule βž” is more aggregated than . There is no guideline on how many levels a warehouse needs, and more than one star schema may sit at the same level.
  • A date dimension may not reach Level-0 βž” Oracle’s date displays only the date portion, so two orders placed by one customer on one day collapse into a single fact row; a true Level-0 DateDIM must store the full date and time to separate them βž” Identifying a Level-0 Star Schema.
  • The measure betrays the level βž” Num_of_Logins is count(*) over the LABACTIVITIES transaction table grouped by Semester, TimePeriod and Degree β€” a count in the build SQL proves the schema is not Level-0 βž” Building Fact Tables.

2. The two ways to lower a level (the only two)

  • Add a new dimension βž” each measure value is literally broken into one value per record of the new dimension; Computer Lab adds and the Level-2 schema becomes Level-1, answering who contributed to the total.
  • Replace with a higher-granularity dimension βž” swap and ; the same measure now sits at the actual login date and time, giving Level-0.
  • A replacement can absorb two dimensions βž” lowering may reduce the dimension count, e.g. a that captures both Order Date and Ordering Method βž” Identifying a Level-0 Star Schema.
  • Count the aggregated dimensions first (Lab 8a) βž” scan the Level- star for dimensions that bucket something finer (Season buckets dates, Location buckets customers); a dimension already at its finest (Ordering Source) is not a candidate. Level-1 lowers one of them, Level-0 lowers them all.
  • Level-1 has no unique answer βž” the lab marks any schema strictly below Level-2 and strictly above Level-0 as correct; the verdict for Level-0 is the strict one β€” check that the fact measure carries no aggregation at all.
  • Design starts high, not low βž” a Level-0 schema holds the same data as the operational database, only restructured, which makes β€œwhy build a star at all?” unanswerable; start where the measures are obviously aggregates and lower from there.

3. Levels are a partial order, not a chain

  • Incomparable siblings βž” Level-1a keyed on and Level-1b keyed on : is finer than but is coarser than β€” neither is more general.
  • What is still decidable βž” both are strictly below Level-2 and strictly above Level-0, so they share a level number without being comparable.
  • The exam question is binary βž” for any two schemas, answer ” is more general than ” or β€œnot comparable”; never invent a ranking βž” Fact Constellation.

4. Facts without fact measures

  • All-ones measure is redundant βž” at Level-0 a count measure is on every row, so the measure may be dropped entirely; then holds nothing but its composite key.
  • Precondition: the measure must be a count βž” a sum measure such as Total_Sales still carries a per-transaction amount at Level-0 and cannot be removed.
  • Merging dimensions does not change granularity βž” folding and into one keyed on LoginNo keeps Level-0, because there is exactly one login per LoginNo.
  • The star is an -ary relationship βž” the measure-less Level-0 fact contains all the information of the E/R diagram, restructured: dimensions entities, fact the transaction relating them.

5. Implementation

  • Level-0 is physical, upper levels are derived βž” Level-0 is built with create table; the upper-level star schemas are normally implemented as views over it.
  • The top level is the dashboard βž” the most aggregated schema is what an interactive management dashboard reads.
  • Build direction follows activity (W11) βž” a passive warehouse is often easier top-down (start at Level-2, lower step by step); an active one must be bottom-up, each level maintained from the one immediately below βž” Active Data Warehousing.

πŸ—‚οΈ Schema

βš–οΈ Core Decision Matrix

MethodTrigger conditionEffect on the measureEffect on the dimension count
Add a new dimensionthe needed detail is an entity the fact never referenced (which student, which computer)each value splits across the new dimension’s members
Replace with a higher-granularity dimensionthe needed detail is a finer version of an existing axis (Semester βž” LoginDate)each value splits along the same axis, or when the replacement absorbs two old dimensions

When It Flips: replacement is forced once an existing dimension is already at its finest (Order Date and Ordering Method cannot be broken down further) β€” then only another dimension can be made more detailed.

πŸ“Š Exam Execution Trace & Applied Exercises

Manual Execution Trace β€” drilling the Computer Lab ladder

LevelFact keySample rowMeasureReading
Level-2Semester, TimePeriod, DegreeS1 Β· 3 Β· BITBIT logins at night in S1
Level-1 StudentNoS1 Β· 3 Β· BIT Β· 21002one student’s share; the column must sum to
Level-1aMonthID, TimePeriod, Degree, StudentMay Β· 3 Β· BIT Β· 21002that student’s May night logins
Level-1bSemester, HourID, Degree, StudentS1 Β· 6:00–6:59pm Β· BIT Β· 21002the same student, by hour, not comparable with Level-1a
Level-0LoginDate, LoginTime, Degree, Student4-Apr Β· 19:00 Β· BIT Β· 21002one actual login βž” the measure is droppable
  • The reconciliation check βž” every drill-down must preserve the total: Level-1 rows under a Level-2 cell that cell. A mismatch means the lower fact was built from a different join, not a finer grouping.

Applied Exercise 1 β€” Clothing Company (Lab 8a, Case Study 1)

Problem: the Level-2 star is over , and . Source tables: CUSTOMER1, ORDER1, ORDER_INV1, INVENTORY1, ITEM1. Draw Level-1 and Level-0.

Applied Exercise 2 β€” Toll Way (Lab 8a, Case Study 2)

Problem: a toll way records, per passage, the gate, registration number, vehicle type, amount paid, and date/time. Management wants revenue drilled down by toll gate, day of week and time period of a day. Draw Level-2, Level-1 and Level-0.

⚠️ Common Mistakes

  • πŸ’‘ β€œIt has all the detailed dimensions, so it is Level-0” βž” lowest-level dimensions do not guarantee an unaggregated measure; the E/R transaction decides βž” Identifying a Level-0 Star Schema.
  • πŸ’‘ Numbering a schema from its own diagram βž” only β€œLevel-0 or not” is visible locally; everything else is relative to the schemas built below it.
  • πŸ’‘ Ranking two same-level schemas βž” if one dimension is finer and another is coarser, they are incomparable β€” asserting an order is a mark-loss answer.

🧠 Active Recall