Chapter 3�Data Warehousing and Analytical Processing
1
Outline
2
Outline
3
What is a Data Warehouse?
4
Data Warehouse—Subject-Oriented
5
Data Warehouse—Integrated
6
Data Warehouse—Time Variant
7
Data Warehouse—Nonvolatile
8
OLTP vs. OLAP
9
Why a Separate Data Warehouse?
10
Data Warehouse: A Multi-Tiered Architecture
11
Three Data Warehouse Models
12
Extraction, Transformation, and Loading (ETL)
13
Metadata Repository
14
Data Lake
15
Layers of Storage
16
Conceptual Architecture
17
(Enterprise) Data Organization
18
Structured data
Unstructured data
Unstructured data with schema
Extraction
Parsing
Schema
Schema inference
Schema inference
Import
Analytics
Data lake
Data Lake Challenges
19
Data Cleaning in Data Lakes
20
Evolving Data in Data Lakes
21
Diversity in Data Lakes
22
Common Tasks in Building Data Lakes
23
Metadata Management in Data Lakes: Ideas
24
Two Purposes and Ecosystems
25
Data Lakehouses
26
Lakehouses
27
Data Fabric and Data Virtualization
28
Data Mesh
29
Data Virtualization
30
Outline
31
From Tables and Spreadsheets to Data Cubes
32
Data Cube: A Lattice of Cuboids
33
time,item
time,item,location
time, item, location, supplier
all
time
item
location
supplier
time,location
time,supplier
item,location
item,supplier
location,supplier
time,item,supplier
time,location,supplier
item,location,supplier
0-D (apex) cuboid
1-D cuboids
2-D cuboids
3-D cuboids
4-D (base) cuboid
Conceptual Modeling of Data Warehouses
34
Star Schema: An Example
35
time_key
day
day_of_the_week
month
quarter
year
time
location_key
street
city
state_or_province
country
location
Sales Fact Table
time_key
item_key
branch_key
location_key
units_sold
dollars_sold
avg_sales
Measures
item_key
item_name
brand
type
supplier_type
item
branch_key
branch_name
branch_type
branch
Snowflake Schema: An Example
36
time_key
day
day_of_the_week
month
quarter
year
time
location_key
street
city_key
location
Sales Fact Table
time_key
item_key
branch_key
location_key
units_sold
dollars_sold
avg_sales
Measures
item_key
item_name
brand
type
supplier_key
item
branch_key
branch_name
branch_type
branch
supplier_key
supplier_type
supplier
city_key
city
state_or_province
country
city
Fact Constellation: An Example
37
time_key
day
day_of_the_week
month
quarter
year
time
location_key
street
city
province_or_state
country
location
Sales Fact Table
time_key
item_key
branch_key
location_key
units_sold
dollars_sold
avg_sales
Measures
item_key
item_name
brand
type
supplier_type
item
branch_key
branch_name
branch_type
branch
Shipping Fact Table
time_key
item_key
shipper_key
from_location
to_location
dollars_cost
units_shipped
shipper_key
shipper_name
location_key
shipper_type
shipper
A Concept Hierarchy for a Dimension (location)
38
all
Europe
North_America
Mexico
Canada
Spain
Germany
Vancouver
M. Wind
L. Chan
...
...
...
...
...
...
all
region
office
country
Toronto
Frankfurt
city
Data Cube Measures: Three Categories
39
Multidimensional Data
40
Product
Region
Month
Dimensions: Product, Location, Time
Hierarchical summarization paths
Industry Region Year
Category Country Quarter
Product City Month Week
Office Day
A Sample Data Cube
41
Total annual sales
of TVs in U.S.A.
Date
Product
Country
sum
sum
TV
VCR
PC
1Qtr
2Qtr
3Qtr
4Qtr
U.S.A
Canada
Mexico
sum
Cuboids Corresponding to the Cube
42
all
product
date
country
product,date
product,country
date, country
product, date, country
0-D (apex) cuboid
1-D cuboids
2-D cuboids
3-D (base) cuboid
Outline
43
Online Analytic Processing (OLAP)
44
OLAP Operations
45
http://www.tutorialspoint.com/dwh/images/rollup.jpg
Other Operations
46
http://en.wikipedia.org/wiki/File:OLAP_pivoting.png
http://www.tutorialspoint.com/dwh/images/dice.jpg
47
Typical OLAP Operations
OLAP Query Example
48
Bitmap Index
49
age | succeed | … |
45 | 1 | … |
37 | 0 | … |
… | … | … |
52 | 1 | … |
1 | 0 | … | 0 |
Indexing OLAP Data Using Bitmap Indices
50
Advantages of Bitmap Index
51
Bit-Sliced Index
52
1 | 0 | 1 | 1 |
1 | 1 | 1 | 0 |
1 | 1 | 1 | 0 |
| | 3 | |
23 | 22 | 21 | 20 |
Indexing OLAP Data Using Bit-sliced Indices
53
Indexing OLAP Data: Join Indices
54
Join Index Example
55
Horizontal versus Vertical Storage
56
A1 | A2 | … | A100 |
x1 | x2 | … | x100 |
… | … | … | … |
z1 | z2 | … | z100 |
A1 | A2 | … | A100 |
x1 | x2 | … | x100 |
… | … | … | … |
z1 | z2 | … | z100 |
Column-based Storage
57
Query Answering Using Vertical Storage
58
Outline
59
Data Cube: A Lattice of Cuboids
60
time,item
time,item,location
time, item, location, supplierc
all
time
item
location
supplier
time,location
time,supplier
item,location
item,supplier
location,supplier
time,item,supplier
time,location,supplier
item,location,supplier
0-D(apex) cuboid
1-D cuboids
2-D cuboids
3-D cuboids
4-D(base) cuboid
Data Cube: A Lattice of Cuboids
61
all
time,item
time,item,location
time, item, location, supplier
time
item
location
supplier
time,location
time,supplier
item,location
item,supplier
location,supplier
time,item,supplier
time,location,supplier
item,location,supplier
0-D(apex) cuboid
1-D cuboids
2-D cuboids
3-D cuboids
4-D(base) cuboid
OLAP Server Architectures
62
Cube Materialization: Full Cube vs. Iceberg Cube
compute cube sales iceberg as
select month, city, customer group, count(*)
from salesInfo
cube by month, city, customer group
having count(*) >= min support
63
iceberg condition
Why Iceberg Cube?
64
Is Iceberg Cube Good Enough? Closed Cube & Cube Shell
65
Q: For (A1, A2, … A100), how many combinations to compute?
Roadmap for Efficient Computation
66
Efficient Data Cube Computation: General Heuristics
67
Example: General Heuristics
68
S. Agarwal, R. Agrawal, P. M. Deshpande, A. Gupta, J. F. Naughton, R. Ramakrishnan, S. Sarawagi. On the computation of multidimensional aggregates. VLDB’96
all
product
date
country
prod,date
prod,country
date, country
prod, date, country
Outline
69
Multi-Way Array Aggregation
70
Cube Computation: Multi-Way Array Aggregation (MOLAP)
71
What is the best traversing order to do multi-way aggregation?
A
B
29
30
31
32
1
2
3
4
5
9
13
14
15
16
64
63
62
61
48
47
46
45
a1
a0
c3
c2
c1
c 0
b3
b2
b1
b0
a2
a3
C
B
44
28
56
40
24
52
36
20
60
Multi-way Array Aggregation (3-D to 2-D)
72
Entire AB plane
One column of AC plane
One chunk of BC plane
4x4x4 chunks
A: 40, B: 400, C: 4000
Multi-Way Array Aggregation (2-D to 1-D)
73
Same methodology for computing 2-D and 1-D planes
Cube Computation: Computing in Reverse Order
74
BUC: Partitioning and Aggregating
75
High-Dimensional OLAP?—The Curse of Dimensionality
76
Fast High-D OLAP with Minimal Cubing
77
Computing a 5-D Cube with 2-Shell Fragments
78
tid | A | B | C | D | E |
1 | a1 | b1 | c1 | d1 | e1 |
2 | a1 | b2 | c1 | d2 | e1 |
3 | a1 | b2 | c1 | d1 | e2 |
4 | a2 | b1 | c1 | d1 | e2 |
5 | a2 | b1 | c1 | d1 | e3 |
Attribute Value | TID List | List Size |
a1 | 1 2 3 | 3 |
a2 | 4 5 | 2 |
b1 | 1 4 5 | 3 |
b2 | 2 3 | 2 |
c1 | 1 2 3 4 5 | 5 |
d1 | 1 3 4 5 | 4 |
d2 | 2 | 1 |
e1 | 1 2 | 2 |
e2 | 3 4 | 2 |
e3 | 5 | 1 |
Shell Fragment Cubes: Ideas
79
Shell Fragment Cubes: Example of Ideas
80
Attribute Value | TID List | List Size |
a1 | 1 2 3 | 3 |
a2 | 4 5 | 2 |
b1 | 1 4 5 | 3 |
b2 | 2 3 | 2 |
c1 | 1 2 3 4 5 | 5 |
d1 | 1 3 4 5 | 4 |
d2 | 2 | 1 |
e1 | 1 2 | 2 |
e2 | 3 4 | 2 |
e3 | 5 | 1 |
Cell | Intersection | TID List | List Size |
a1 b1 | 1 2 3 ∩ 1 4 5 | 1 | 1 |
a1 b2 | 1 2 3 ∩ 2 3 | 2 3 | 2 |
a2 b1 | 4 5 ∩ 1 4 5 | 4 5 | 2 |
a2 b2 | 4 5 ∩ 2 3 | φ | 0 |
tid | count | sum |
1 | 5 | 70 |
2 | 3 | 10 |
3 | 8 | 20 |
4 | 5 | 40 |
5 | 2 | 30 |
Shell-fragment AB
Shell Fragment Cubes: Size and Design
81
Use Frag-Shells for Online OLAP Query Computation
82
A | B | C | D | E | F | … |
ABC Cube
DEF Cube
D Cuboid
EF Cuboid
DE Cuboid
Cell | Tuple-ID List |
d1 e1 | {1, 3, 8, 9} |
d1 e2 | {2, 4, 6, 7} |
d2 e1 | {5, 10} |
… | … |
Dimensions
A | B | C | D | E | F | G | H | I | J | K | L | M | N | … |
Online
Cube
Instantiated
Base Table
Processing query in the form: <a1, a2, …, an: M>
Online Query Computation with Shell-Fragments
83