Data Cube Computation & Data Generalization
Materializing cubes, base vs aggregate cells, iceberg cubes, MultiWay array aggregation, BUC, star-nodes and star-trees, and attribute-oriented induction (AOI).
▶Lecture videos
Click any timestamp — here or inside the notes — to jump the video to that moment. Your position is remembered.
Data Cube Computation
Walkthrough of cube materialization and efficient computation methods.
00:02A simple data cube example (product, location, time)01:55The apex cuboid: the most summarised view02:51Base cells: P1, Calgary, Wednesday…04:37Aggregate cells and slices ("*" = all)06:24Reading aggregate values (111, 27…)08:22Two categories of cube computation09:27Simultaneous aggregation: base → 1-D → 2-D cells11:09Example: Apple, Central Province, January13:04How aggregated values are updated1Why compute cubes efficiently?
- Data cube computation is an essential task in warehouse implementation.
- Pre-computing all or part of a cube greatly reduces response time and improves OLAP performance.
- The challenge: it can need substantial computation time and storage space.
2Cube materialization: cells and cuboids
A data cube is a lattice of cuboids, and each cuboid is a group-by. For dimensions A, B, C:
all ← apex cuboid (0-D): most generalized, ONE value
A B C ← 1-D cuboids
AB AC BC ← 2-D cuboids
ABC ← base cuboid (3-D): least generalized
- Drill down: move from the apex down toward the base.
- Roll up: move from the base up toward the apex.
Base cells vs aggregate cells
- A cell in the base cuboid is a base cell. A cell in any non-base cuboid is an aggregate cell.
- In an aggregate cell, each aggregated dimension is written as *.
- A cell a = (a₁, …, aₙ, measures) is an m-dimensional cell if exactly m values are not "*".
- m = n → base cell
- m < n → aggregate cell
| Cell | Type |
|---|---|
| (Jan, *, *, 2800) | 1-D aggregate cell |
| (*, Toronto, *, 1200) | 1-D aggregate cell |
| (Jan, *, Business, 150) | 2-D aggregate cell |
| (Jan, Toronto, Business, 45) | 3-D base cell |
Ancestors and descendants
An i-D cell a is an ancestor of a j-D cell b (and b is a descendant of a) if and only if:
- i < j, and
- a and b agree on every dimension where a is not "*".
If additionally j = i + 1, then a is the parent and b is the child.
Example: (Jan, *, *) is an ancestor of (Jan, Toronto, Business) and the parent of (Jan, Toronto, *).
Choose a base cell. Every highlighted cell is an aggregate that this one base tuple adds to. This is exactly what MultiWay does when it fills a cell. Click any cell to see its ancestors and descendants.
3Full cube vs iceberg cube
Full cube
Pre-computing all cells of all cuboids gives the fastest OLAP, but:
- It's exponential in the number of dimensions: n dimensions → 2ⁿ cuboids. With concept hierarchies there are even more:
- Each cuboid's size depends on the cardinality of its dimensions.
- So the full cube can need huge, excessive memory.
Iceberg cube
- Cube cells are usually sparse. A customer buys only a few items, so most cells are empty or have tiny values.
- Instead, materialize only cells whose measure passes a minimum threshold (the iceberg condition), e.g. count ≥ 10 or sales ≥ $100.
A partially materialized cube that stores only cells meeting the iceberg condition. It saves processing time and disk space and gives a more focused analysis. Cells below the threshold are usually too trivial to analyse.
Time has levels day < month < quarter < year (L = 4); item has 2 levels; location has 3.
Cuboids = (4+1)(2+1)(3+1) = 60, compared with only 2³ = 8 without hierarchies.
4MultiWay array aggregation
Data structures: ROLAP stores cuboids in relational tables. MOLAP uses multidimensional arrays. Two methods for computing full cubes are covered: MultiWay (array-based) and BUC.
The chunked array
- Take a 3-D array for A, B, C, partitioned into small memory-based chunks.
- Each dimension is split into 4 equal partitions, giving 4 × 4 × 4 = 64 chunks (chunk 1 = a0b0c0, chunk 2 = a1b0c0, …, chunk 64 = a3b3c3).
- Cardinalities A = 40, B = 400, C = 4000 → partition sizes 10, 100, 1000.
Cuboids to compute for the full cube:
- ABC: the base cuboid, already given as the 3-D array. Everything else is computed from it, directly or indirectly.
- AB, AC, BC: 2-D cuboids
- A, B, C: 1-D cuboids
- all: the apex, group-by (); one value, e.g. the total count
Simultaneous aggregation
The key idea is that when a base cell is read, all the aggregate cells it belongs to are updated at the same time. Then the array is scanned once, not once per cuboid.
Reading the base tuple {P1, Calgary, Vance} (count 2) adds 2 to all of these at once:
- 2-D: {P1, Calgary, *}, {P1, *, Vance}, {*, Calgary, Vance}
- 1-D: {P1, *, *}, {*, Calgary, *}, {*, *, Vance}
- Apex: {*, *, *}
Do this for every row and the whole cube is filled. The tool above shows this.
MultiWay visits chunks in an order that minimises memory: the 2-D planes kept in memory should be for the smallest dimensions (here, AB, since A = 40 and B = 400 are smallest). The largest plane (BC) only needs one chunk in memory at a time.
5BUC — Bottom-Up Computation
- BUC builds the cube from the apex cuboid toward the base cuboid, the opposite direction to MultiWay.
- The usual lattice drawing puts the apex (all) at the top and the base (ABC) at the bottom.
BUC stands for "Bottom-Up Construction", but in the standard lattice drawing (apex at top) its processing order is actually top-down: it starts at all and drills down toward ABC. The name comes from a worldview where the apex is drawn at the bottom.
BUC's exploration order for a 3-D cube (Figure 8-4):
all → A → AB → ABC → AC → B → BC → C
It partitions on A, then recursively on B within each A partition, and so on, depth-first. BUC's strength: iceberg pruning. If a partition fails the minimum support, none of its descendants can pass, so BUC stops exploring that branch.
6Star attributes, star-nodes and star-trees
- If the single-dimension aggregate for an attribute value p fails the iceberg condition, there's no point treating p separately.
- Replace p with *. Then p is a star-node; values that pass are non-star-nodes.
- A cuboid tree compressed this way is a star-tree. A star-table lists the star-nodes.
Base table: 5 tuples, 4 dimensions, cardinalities A = 2, B = 4, C = 4, D = 4.
- Values meeting min_sup = 2: a1 (3), a2 (2), b1 (2), c3 (2), d4 (2). All others are star-nodes.
- After replacing star-nodes with * and merging, the reduced table is:
| A | B | C | D | count |
|---|---|---|---|---|
| a1 | b1 | * | * | 2 |
| a1 | * | * | * | 1 |
| a2 | * | c3 | d4 | 2 |
That's two fewer rows and fewer distinct values, so the star-tree built from it is much smaller.
7Attribute-oriented induction (AOI)
Data generalization replaces low-level values (numeric age) with higher-level concepts (young, middle-aged, senior), so large data can be described concisely at multiple levels of abstraction.
Data cube approach
- Based on materialized views pre-computed in the warehouse
- Off-line aggregation before the query arrives
Attribute-oriented induction (1989)
- Query-oriented, generalization-based, on-line analysis
- Proposed a few years before the data cube approach
The AOI idea
- Collect the task-relevant data with a database query.
- Generalize by looking at the number of distinct values of each attribute: either attribute removal or attribute generalization.
- Aggregate by merging identical generalized tuples and accumulating their counts.
- Present the result as charts, cross-tabs or rules.
The two rules
Attribute removal
If an attribute has many distinct values but either:
- there is no generalization operator (no concept hierarchy), or
- its higher-level concepts are expressed by other attributes
→ remove it.
Attribute generalization
If an attribute has many distinct values and a generalization operator exists
→ apply it (climb the hierarchy) until the number of distinct values ≤ the attribute generalization threshold.
Worked example: "Science Students" at Big University
use Big_University_DB
mine characteristics as "Science_Students"
in relevance to name, gender, major, birth_place, birth_date,
residence, phone#, gpa
from student
where status in "graduate"
Step 1: initial (working) relation. Data focusing collects the task-relevant tuples.
| name | gender | major | birth_place | birth_date | residence | phone# | gpa |
|---|---|---|---|---|---|---|---|
| Jim Woodman | M | CS | Vancouver, BC, Canada | 8-12-76 | 3511 Main St., Richmond | 687-4598 | 3.67 |
| Scott Lachance | M | CS | Montreal, Que, Canada | 28-7-75 | 345 1st Ave., Richmond | 253-9106 | 3.70 |
| Laura Lee | F | Physics | Seattle, WA, USA | 25-8-70 | 125 Austin Ave., Burnaby | 420-5232 | 3.83 |
| … | … | … | … | … | … | … | … |
Step 2: prepare for generalization. Decide each attribute:
| Attribute | Decision | Why |
|---|---|---|
| name | Removed | Many distinct values, no generalization operator |
| gender | Retained as is | Only 2 distinct values |
| major | Generalized → | Hierarchy exists; > 20 values vs threshold 5 |
| birth_place | Generalized → birth_country (or removed if countries still exceed the threshold) | Hierarchy city < province < country |
| birth_date | Generalized → age → age_range | Few age ranges, under the threshold |
| residence | number and street removed → residence_city | Too low-level |
| phone# | Removed | Too many values, no hierarchy |
| gpa | Generalized → | Interval hierarchy exists |
Step 3: derive the prime relation P. Insert the generalized tuples and merge identical ones, keeping a count:
| gender | major | birth_country | age_range | residence_city | gpa | count |
|---|---|---|---|---|---|---|
| M | Science | Canada | 20–25 | Richmond | very good | 16 |
| F | Science | Foreign | 25–30 | Burnaby | excellent | 22 |
| … | … | … | … | … | … | … |
Step 4: presentation. The user interacts by drilling, pivoting and mapping into rules, and controls how it is visualised, e.g. as a cross-tab:
| birth_country | M | F | Total |
|---|---|---|---|
| Canada | 16 | 10 | 26 |
| Foreign | 14 | 22 | 36 |
| Total | 30 | 32 | 62 |
For AOI questions, explain the two rules (removal vs generalization) and walk through the attributes name, gender, major, birth_place, birth_date, residence, phone#, gpa with the decision for each. That table is the core of the answer.
8Quick revision sheet
| Concept | Remember it as |
|---|---|
| Base cell / aggregate cell | All n values set / at least one "*" |
| m-D cell | Exactly m non-* values |
| Ancestor | Fewer dims, agrees where not *; parent if exactly one fewer |
| Full cube size | 2ⁿ cuboids; with hierarchies Π(Lᵢ + 1) |
| Iceberg cube | Store only cells with measure ≥ threshold (count ≥ 10, sales ≥ $100) |
| ROLAP / MOLAP structures | Relational tables / multidimensional arrays |
| MultiWay | Chunked array; one base cell updates all its aggregate cells simultaneously |
| BUC | Apex → base; called bottom-up but explores top-down; prunes iceberg branches |
| Star-node | Value whose 1-D aggregate fails the iceberg condition → *; star-tree, star-table |
| AOI | Query-oriented, on-line (1989); removal vs generalization; prime relation with counts |
?Self-check quiz
11 questions on this week. Answer them all, then press Check my answers. Your best and latest scores are saved and shown on the subject page.