Skip to content
GATEiit

GATE DA · Database Management and Warehousing

Concept hierarchies; measures: categorization and computations

Concept hierarchies (schema, lattice and set-grouping) that let a cube roll up from detailed to general values, and the distributive, algebraic and holistic measures that decide how aggregates are computed. GATE asks classification and combine-the-partitions numericals.

Before you start

This topic comes before: Data warehouse modelling: schemas for multidimensional data models

Concept notes

1. Concept hierarchies

A concept hierarchy maps low-level, specific values of an attribute to higher-level, more general concepts. Example for location: street < city < state < country. Mumbai and Pune map to Maharashtra; Maharashtra maps to India.

Kinds:

  • Schema hierarchy: an order on the attributes of a dimension table.
    • Total order: a chain, such as street < city < state < country.
    • Partial order (lattice): branches, such as time: day < {month < quarter; week} < year. A week does not fit inside one month, so week and month are not comparable.
  • Set-grouping hierarchy: groups the values of one attribute into ranges or sets, such as price ₹0–100 and ₹100–200 forming ₹0–200, or {A, B} = good grades.
  • Operation-derived / rule-based: produced by an operation (splitting an email address into user and domain) or by rules.

The top of every hierarchy is the special value all. Roll-up climbs a hierarchy, drill-down descends it.

all year quarter month week day generalspecific
The time dimension is a lattice (partial order): week is not inside month, so the hierarchy branches between day and year

2. Building hierarchies

Hierarchies come from domain experts, from the schema, or are generated automatically.

  • Numeric attributes: apply discretization recursively (binning, histogram analysis, cluster analysis, entropy-based splitting). Each round of splitting gives one more level.
  • Nominal attributes: a user may give only the set of attributes (street, city, state, country) without the order. A common heuristic orders them by the number of distinct values: the attribute with the most distinct values goes at the lowest (most specific) level, the one with the fewest at the top.

Example: country 12, state 300, city 2,800, street 4,50,000 distinct values gives street < city < state < country.

The heuristic can fail. For time, weekday has 7 values, month 12 and year perhaps 20, but year is clearly above month, and weekday is not above month at all. Such cases need the user to correct the order.

A user may also give part of a hierarchy (city < state) and let the system fill in the rest from the schema or data.

3. Categorizing measures: distributive, algebraic, holistic

Suppose the data is split into partitions and a measure is computed on each. The measure's category says whether the whole-data value can be built from the partition values.

  • Distributive: applying the same function to the partition results gives the whole-data result. count (sum the counts), sum, min, max.
  • Algebraic: computable by an algebraic function of a bounded number M of distributive measures. average = sum / count (M=2); variance and standard deviation from count, ∑x and ∑x2 (M=3); min_N and max_N (the N smallest or largest values); centre of mass.
  • Holistic: no constant-size summary of each partition is enough. median, mode, rank, number of distinct values.
Category Combine partitions by Examples
Distributive same function count, sum, min, max
Algebraic fixed-size tuple of distributive values avg, variance, std dev, min_N, max_N
Holistic needs (nearly) all the data median, mode, rank

Note that count is distributive but is combined by summing the partition counts.

4. Computing measures from partial aggregates

Keep the right summary for each partition and you can combine exactly.

  • Average: keep (nj,Sj) where Sj=∑x. Overall mean =∑jSj∑jnj. The average of the averages is wrong unless all partitions have the same size.
  • Variance: keep (nj,Sj,Qj) with Qj=∑x2. With n=∑nj, S=∑Sj, Q=∑Qj: σ2=Qn−(Sn)2
  • Median (holistic): two partitions can have the same medians while the overall median differs. {1, 2, 3} with {4, 5, 6} has median 3.5; {1, 2, 9} with {4, 5, 6} has the same partition medians 2 and 5 but overall median 4.5.

So the summary needed per partition is: 1 value for distributive, a fixed number for algebraic, and an unbounded amount for holistic measures.

5. Why the category matters for cube computation

In a data cube, a higher (coarser) cuboid can be computed from a lower (finer) one by aggregating its cells: rolling up from month to quarter just combines the three month cells of each quarter.

  • For distributive measures this is direct: quarterly sales = sum of monthly sales; quarterly max = max of monthly maxima.
  • For algebraic measures store the distributive pieces in each cell (sum and count for average) and divide only at the end.
  • For holistic measures, no fixed-size cell value lets you roll up. The system must go back to the base data or keep an approximation (for example an approximate median from a histogram of counts).

This is why warehouses prefer distributive and algebraic measures, and why efficient cube computation and partial materialisation are straightforward for them but costly for holistic ones.

Rolling up a dimension from c values at one level to c′ values at a higher level shrinks the number of cells in that direction from c to c′; the other dimensions are unchanged.

Formulas to remember

Combined meanSj = sum and nj = count of partition j
xˉ=∑jSj∑jnj
Variance from distributive piecesn = count, S=∑x, Q=∑x2 (population variance)
σ2=Qn−(Sn)2
Count across partitions
count=∑jcountj
Min and max across partitions
max⁡=max⁡j(max⁡j),min⁡=min⁡j(min⁡j)

Common mistakes

  • Averaging partition averages when the partitions have different sizes; combine sums and counts instead.
  • Calling average distributive; it is algebraic because it needs two distributive values.
  • Calling count algebraic because it is combined by summing; it is distributive.
  • Assuming the median of medians equals the overall median; median is holistic.
  • Applying the distinct-value heuristic blindly to time attributes such as weekday, month and year.

Worked examples

Try each step yourself, then reveal the working.

Example 1: Variance from two partitions

numerical

Partition A has n=4, ∑x=40, ∑x2=410. Partition B has n=6, ∑x=90, ∑x2=1370. Find the overall mean and population variance without seeing the data.

  1. Step 1: Add the distributive pieces.

    Try it on paper first.

Example 2: Average of averages is wrong

numerical

Region North has 3 stores with average sales 20 (lakh). Region South has 1 store with sales 40. Roll up to the national level: what is the average sales per store?

  1. Step 1: Try the shortcut first.

    Try it on paper first.

Example 3: Rolling up a measure along the time hierarchy

numerical

Monthly sales: Jan 20, Feb 25, Mar 30, Apr 15, May 10, Jun 35. Roll up to quarters, and give the half-year total, maximum monthly sale and average monthly sale using only the quarter-level summaries.

  1. Step 1: Roll up to quarters, keeping sum, count and max.

    Try it on paper first.

Example 4: Classify the measures

conceptual

Classify as distributive, algebraic or holistic: count, average, standard deviation, max, top-3 values (max_3), median, mode.

  1. Step 1: Which can be combined by the same function?

    Try it on paper first.

Previous year questions

3 official GATE DA questions on this topic, newest first.

Practise these 3 PYQs →

Topic test

10 questions: up to 3 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.