156
Information Systems for Engineers 9. OLAP and Data Cubes Ghislain Fourny Spring 2020 Information Systems for Engineers Ghislain Fourny fotoreactor / 123RF Stock Photo

Information Systems for Engineers 9. OLAP and Data Cubes

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Information Systems for Engineers 9. OLAP and Data Cubes

Information Systems for Engineers9. OLAP and Data Cubes

Ghislain FournySpring 2020

Information Systems for EngineersGhislain Fourny

fotoreactor / 123RF Stock Photo

Page 2: Information Systems for Engineers 9. OLAP and Data Cubes

The road to analytics

Aurelio Scetta / 123RF Stock Photo

Page 3: Information Systems for Engineers 9. OLAP and Data Cubes

Another history of data management(T. Hofmann)

Age of Transactions1970s – 2000s

Page 4: Information Systems for Engineers 9. OLAP and Data Cubes

Another history of data management(T. Hofmann)

Age of Transactions

Age of Business Intelligence

1970s – 2000s

1995 -

Page 5: Information Systems for Engineers 9. OLAP and Data Cubes

Another history of data management(T. Hofmann)

Age of Transactions

Age of Business Intelligence

Age of Big Data

1970s – 2000s

1995 -

2000s -

Page 6: Information Systems for Engineers 9. OLAP and Data Cubes

Paradigms

OLTP

Page 7: Information Systems for Engineers 9. OLAP and Data Cubes

Paradigms

OLTP OLAP

vs.

Page 8: Information Systems for Engineers 9. OLAP and Data Cubes

OnLine Transaction Processing

ConsistentandReliableRecord-Keeping

Page 9: Information Systems for Engineers 9. OLAP and Data Cubes

OnLine Transaction Processing

Transactionsand resultson

small portionsof data

Page 10: Information Systems for Engineers 9. OLAP and Data Cubes

OnLine Transaction Processing

Lotsof transactionson

small portionsof data

Page 11: Information Systems for Engineers 9. OLAP and Data Cubes

OnLine Transaction Processing

NormalizedData

Page 12: Information Systems for Engineers 9. OLAP and Data Cubes

OnLine Analytical Processing

Data-basedDecisionSupport arturaliev / 123RF Stock Photo

Page 13: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP is Big

Large portionsof the data

Page 14: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP is Big

Possiblymany joins

Large portionsof the data

Page 15: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP is Big

Possiblymany joins

Large portionsof the data

Few longheavy queries

Page 16: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP Examples

Web analytics

Sales analytics

Management support

Statistical analysis (census)

Scientific databases (e.g., bio-informatics)

Page 17: Information Systems for Engineers 9. OLAP and Data Cubes

OLTP vs. OLAP

DetailedIndividualRecords

HistoricalSummarizedConsolidated

DataAurelio Scetta / 123RF Stock Photo

OLTP OLAP

vs.

Page 18: Information Systems for Engineers 9. OLAP and Data Cubes

OLTP vs. OLAP

OLTP

Lots of writes

OLAP

Lots of reads

vs.

Page 19: Information Systems for Engineers 9. OLAP and Data Cubes

OLTP vs. OLAP

OLTP

Small setsof records

OLAP

vs.Analysis

over big chunks

Page 20: Information Systems for Engineers 9. OLAP and Data Cubes

OLTP vs. OLAP

OLTP OLAP

Slow interactive

vs.

fully interactive(< 1s)

Page 21: Information Systems for Engineers 9. OLAP and Data Cubes

OLTP vs. OLAP

OLTP OLAP

Consistency

RedundancyRedundancyRedundancy

Page 22: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP

Aurelio Scetta / 123RF Stock Photo

Page 23: Information Systems for Engineers 9. OLAP and Data Cubes

A data warehouse

... is a

Page 24: Information Systems for Engineers 9. OLAP and Data Cubes

A data warehouse

... is a

subject-oriented

Page 25: Information Systems for Engineers 9. OLAP and Data Cubes

A data warehouse

... is a

subject-orientedintegrated

Page 26: Information Systems for Engineers 9. OLAP and Data Cubes

A data warehouse

... is a

subject-orientedintegratedtime-variant

Page 27: Information Systems for Engineers 9. OLAP and Data Cubes

A data warehouse

... is a

subject-orientedintegratedtime-variantnonvolatile

Page 28: Information Systems for Engineers 9. OLAP and Data Cubes

A data warehouse

... is a

subject-orientedintegratedtime-variantnonvolatilecollection of data

in support of management'sdecision-making process

Page 29: Information Systems for Engineers 9. OLAP and Data Cubes

Subject-oriented

customers

products

sales

events

Page 30: Information Systems for Engineers 9. OLAP and Data Cubes

Integrated

Page 31: Information Systems for Engineers 9. OLAP and Data Cubes

Time-variant

Timein data warehouses is

paramount(not so in OLTP systems)

Page 32: Information Systems for Engineers 9. OLAP and Data Cubes

Time-variant

2019Y-1Y-2Y-3Y-4Y-5Y-6Y-7Y-8Y-9

Often past 5-10 years

Page 33: Information Systems for Engineers 9. OLAP and Data Cubes

Non-volatile

Milosh Kojadinovich / 123RF Stock Photo

Load.

Page 34: Information Systems for Engineers 9. OLAP and Data Cubes

Non-volatile

Milosh Kojadinovich / 123RF Stock Photo

Load.Access.

Page 35: Information Systems for Engineers 9. OLAP and Data Cubes

Non-volatile

Milosh Kojadinovich / 123RF Stock Photo

Load.Access.Period.

Page 36: Information Systems for Engineers 9. OLAP and Data Cubes

Non-volatile

Milosh Kojadinovich / 123RF Stock Photo

Load.Access.Period.

no updates

Page 37: Information Systems for Engineers 9. OLAP and Data Cubes

Architecture

ERP

CRM

OLTP

Files

Page 38: Information Systems for Engineers 9. OLAP and Data Cubes

Architecture

ERP

CRM

OLTP

ETL

Files

Page 39: Information Systems for Engineers 9. OLAP and Data Cubes

Architecture

ERP

CRM

OLTP

ETL

Files

Analyze

Report

Mine

Page 40: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP: Redundancy

Page 41: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP: Redundancy

Materializedviews

(denormalized)

Page 42: Information Systems for Engineers 9. OLAP and Data Cubes

1st Normal Form (tabular) – The Key

Page 43: Information Systems for Engineers 9. OLAP and Data Cubes

2nd Normal Form (not joined) – The Whole Key

Page 44: Information Systems for Engineers 9. OLAP and Data Cubes

3rd Normal Form – Nothing But The Key

Page 45: Information Systems for Engineers 9. OLAP and Data Cubes

Why materialize?

Operational data sourcesare too heterogeneous

Page 46: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP: Derived data

Page 47: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP: Special-purpose indices

Page 48: Information Systems for Engineers 9. OLAP and Data Cubes

Querying OLAP

0

1

2

3

4

5

6

Category 1 Category 2 Category 3 Category 4

Slow interactive

Series 1 Series 2 Series 3

1 - 10s

Page 49: Information Systems for Engineers 9. OLAP and Data Cubes

Querying OLAP

vs.Continuous

monitoring/tracking0

1

2

3

4

5

6

Category 1 Category 2 Category 3 Category 4

Slow interactive

Series 1 Series 2 Series 3

1 - 10s hours

Page 50: Information Systems for Engineers 9. OLAP and Data Cubes

Summary of differences

OLTP OLAPSource Original (operational) Derived (consolidated)Purpose Business tasks Decision supportInterface Snapshot Multidimensional viewsWriting short and fast, by end user period refreshes, by batch jobsQueries Simple, small results Complex and aggregatingDesign Many normalized tables Few denormalized cubesPrecision ACID Sampling, confidence intervalsFreshness Serializability ReproducibilitySpeed Very fast Often slowOptimization Inter-query Intra-querySpace Small, archiving old data Large, less space efficientBackup Very important Re-ETL

Page 51: Information Systems for Engineers 9. OLAP and Data Cubes

Data Model

Page 52: Information Systems for Engineers 9. OLAP and Data Cubes

Data Cubes

Data is stored in

multidimensionalhypercubes

Page 53: Information Systems for Engineers 9. OLAP and Data Cubes

Data Cubes

Year

Page 54: Information Systems for Engineers 9. OLAP and Data Cubes

Data Cubes

Country

Page 55: Information Systems for Engineers 9. OLAP and Data Cubes

Data Cubes

Product

Page 56: Information Systems for Engineers 9. OLAP and Data Cubes

Fact

2016CH

Server

Page 57: Information Systems for Engineers 9. OLAP and Data Cubes

Dimensions

Where

What?

Who? etc.

Which currency?

When?

Page 58: Information Systems for Engineers 9. OLAP and Data Cubes

Fact table

Where?

Germany 2016 Peter 1,000$

Germany 2015 Mary 15,000$

Switzerland 2016 Mary 1,500$

Switzerland 2015 Peter 3,000$

Australia 2015 Peter 6,000$

China 2015 Mary 1,000$

Page 59: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregation

Where?

Germany 2016 Peter 1,000$

Germany 2015 Mary 15,000$

Switzerland 2016 Mary 1,500$

Switzerland 2015 Peter 3,000$

Australia 2015 Peter 6,000$

China 2015 Mary 1,000$

Page 60: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregation

Page 61: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregation

Where?

Germany 2016 Peter 1,000$

Germany 2015 Mary 15,000$

Switzerland 2016 Mary 1,500$

Switzerland 2015 Peter 3,000$

Australia 2015 Peter 6,000$

China 2015 Mary 1,000$

Page 62: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregation

2016 Peter 1,000$

2015 Mary 16,000$

2016 Mary 1,500$

2015 Peter 9,000$

Page 63: Information Systems for Engineers 9. OLAP and Data Cubes

Slicing

Page 64: Information Systems for Engineers 9. OLAP and Data Cubes

Slicers and Dicers

Dicers Slicers

Page 65: Information Systems for Engineers 9. OLAP and Data Cubes

Slicers and Dicers

Usually between1 and 3 dicers,

often 2

Dicers Slicers

Page 66: Information Systems for Engineers 9. OLAP and Data Cubes

Slicers and Dicers

Servers

World

USD

Slicers

Page 67: Information Systems for Engineers 9. OLAP and Data Cubes

Slicers and Dicers

2014 2015 2016

Peter 1,000,000$ 1,500,000$ 1,400,000$

Mary 2,000,000$ 2,300,000$ 2,200,000$

Servers

World

USD

Dicers

Slicers

Page 68: Information Systems for Engineers 9. OLAP and Data Cubes

Products: the big three

Essbase

Cognos

Analysis Services

Page 69: Information Systems for Engineers 9. OLAP and Data Cubes

ETLing

Page 70: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP: Derived data

Page 71: Information Systems for Engineers 9. OLAP and Data Cubes

OLAP: Derived data

ETL

Page 72: Information Systems for Engineers 9. OLAP and Data Cubes

ETL

ExtractTransformLoad

Page 73: Information Systems for Engineers 9. OLAP and Data Cubes

Extract

Triggers

Incremental updates

Page 74: Information Systems for Engineers 9. OLAP and Data Cubes

Extract

Triggers Gateways

Incremental updates

Page 75: Information Systems for Engineers 9. OLAP and Data Cubes

Extract

Triggers Gateways

Incremental updates Log extraction

Page 76: Information Systems for Engineers 9. OLAP and Data Cubes

Transform

Derivation

Page 77: Information Systems for Engineers 9. OLAP and Data Cubes

Transform

Derivation Value transformation

Herr

Mister

Page 78: Information Systems for Engineers 9. OLAP and Data Cubes

Transform

Derivation Value transformation

Herr

Mister

Cleaning

Page 79: Information Systems for Engineers 9. OLAP and Data Cubes

Transform

Derivation Value transformation

Herr

Mister

CleaningFilter, split, merge, join

Page 80: Information Systems for Engineers 9. OLAP and Data Cubes

Load

Integrity constraints

Page 81: Information Systems for Engineers 9. OLAP and Data Cubes

Load

Integrity constraints Sorting

Page 82: Information Systems for Engineers 9. OLAP and Data Cubes

Load

Integrity constraints Sorting

Build indices

Page 83: Information Systems for Engineers 9. OLAP and Data Cubes

Load

Integrity constraints Sorting

Build indices Partition

Page 84: Information Systems for Engineers 9. OLAP and Data Cubes

Considerations

When?

Page 85: Information Systems for Engineers 9. OLAP and Data Cubes

Considerations

When?Granularity

Page 86: Information Systems for Engineers 9. OLAP and Data Cubes

Considerations

When?Granularity

Infrastructure

Page 87: Information Systems for Engineers 9. OLAP and Data Cubes

Implementation

Page 88: Information Systems for Engineers 9. OLAP and Data Cubes

Two flavors of OLAP

ROLAP

Page 89: Information Systems for Engineers 9. OLAP and Data Cubes

Two flavors of OLAP

ROLAP MOLAP

Page 90: Information Systems for Engineers 9. OLAP and Data Cubes

Fact table (ROLAP)

Dim1 Dim2 Dim3 Dim4 Dim5 Value

Page 91: Information Systems for Engineers 9. OLAP and Data Cubes

Fact table (ROLAP), with multiple measures

Dim1 Dim2 Dim3 Dim4 Dim5 Mes1 Mes2 Mes3

Page 92: Information Systems for Engineers 9. OLAP and Data Cubes

Star Schema

Dim1 Dim2 Dim3 Dim4 Dim5 Value

Page 93: Information Systems for Engineers 9. OLAP and Data Cubes

Snow-flake schema

Dim1 Dim2 Dim3 Dim4 Dim5 Value

NormalizeMore

Page 94: Information Systems for Engineers 9. OLAP and Data Cubes

Querying

Page 95: Information Systems for Engineers 9. OLAP and Data Cubes

Querying cubes

Tables:SQL

Page 96: Information Systems for Engineers 9. OLAP and Data Cubes

Querying cubes

Tables:SQL

Cubes:MDX

Page 97: Information Systems for Engineers 9. OLAP and Data Cubes

Sample Cube (ROLAP)

SalesDate Product Customer Quantity2017-01-01 iPhone X Peter 12017-01-01 Samsung Galaxy S9 Peter 22017-01-01 iPhone X Mary 52017-01-01 Samsung Galaxy S9 Mary 32016-01-01 iPhone X Peter 32016-01-01 Samsung Galaxy S9 Peter 22016-01-01 iPhone X Mary 62016-01-01 Samsung Galaxy S9 Mary 32015-01-01 iPhone X Peter 32015-01-01 Samsung Galaxy S9 Peter 12015-01-01 iPhone X Mary 22015-01-01 Samsung Galaxy S9 Mary 3

Page 98: Information Systems for Engineers 9. OLAP and Data Cubes

Satellite tables

TimeDate Year Quarter2017-01-01 2017 12016-01-01 2016 12015-01-01 2015 1

CustomerName Country PhonePeter UK 555-55-55Mary Switzerland 555-55-56

ProductName Brand PriceiPhone X Apple 1000Samsung Galaxy S9 Samsung 800

Page 99: Information Systems for Engineers 9. OLAP and Data Cubes

Querying with SQL

SELECT *FROM Sales s

Page 100: Information Systems for Engineers 9. OLAP and Data Cubes

Querying with SQL

SELECT *FROM Sales s

Sales

Date Product Customer Quantity

2017-01-01 iPhone X Peter 1

2017-01-01 Samsung Galaxy S9 Peter 2

2017-01-01 iPhone X Mary 5

2017-01-01 Samsung Galaxy S9 Mary 3

2016-01-01 iPhone X Peter 3

2016-01-01 Samsung Galaxy S9 Peter 2

2016-01-01 iPhone X Mary 6

2016-01-01 Samsung Galaxy S9 Mary 3

2015-01-01 iPhone X Peter 3

2015-01-01 Samsung Galaxy S9 Peter 1

2015-01-01 iPhone X Mary 2

2015-01-01 Samsung Galaxy S9 Mary 3

Page 101: Information Systems for Engineers 9. OLAP and Data Cubes

Joining with satellite tables

SELECT t.Year, s.Product, s.Customer, s.QuantityFROM Sales s, Time tWHERE s.Date = t.Date

Page 102: Information Systems for Engineers 9. OLAP and Data Cubes

Joining with satellite tables

SELECT t.Year, s.Product, s.Customer, s.QuantityFROM Sales s, Time tWHERE s.Date = t.Date

Year Product Customer Quantity

2017 iPhone X Peter 1

2017 Samsung Galaxy S9 Peter 2

2017 iPhone X Mary 5

2017 Samsung Galaxy S9 Mary 3

2016 iPhone X Peter 3

2016 Samsung Galaxy S9 Peter 2

2016 iPhone X Mary 6

2016 Samsung Galaxy S9 Mary 3

2015 iPhone X Peter 3

2015 Samsung Galaxy S9 Peter 1

2015 iPhone X Mary 2

2015 Samsung Galaxy S9 Mary 3

Page 103: Information Systems for Engineers 9. OLAP and Data Cubes

Slicing

SELECT t.Year, s.Product, s.Customer, s.QuantityFROM Sales s, Time tWHERE s.Date = t.Date

AND t.Year = 2017

Page 104: Information Systems for Engineers 9. OLAP and Data Cubes

Slicing

SELECT t.Year, s.Product, s.Customer, s.QuantityFROM Sales s, Time tWHERE s.Date = t.Date

AND t.Year = 2017

Year Product Customer Quantity

2017 iPhone X Peter 1

2017 Samsung Galaxy S9 Peter 2

2017 iPhone X Mary 5

2017 Samsung Galaxy S9 Mary 3

Page 105: Information Systems for Engineers 9. OLAP and Data Cubes

Slicing

SELECT t.Year, s.Product, s.Customer, s.QuantityFROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameAND t.Year = 2017AND p.Brand = 'Samsung'

Page 106: Information Systems for Engineers 9. OLAP and Data Cubes

Slicing

SELECT t.Year, s.Product, s.Customer, s.QuantityFROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameAND t.Year = 2017AND p.Brand = 'Samsung' Year Product Customer Quantity

2017 Samsung Galaxy S9 Peter 2

2017 Samsung Galaxy S9 Mary 3

Page 107: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregating

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.NameAND p.Brand = 'Samsung'

GROUP BY t.Year

Page 108: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregating

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.NameAND p.Brand = 'Samsung'

GROUP BY t.Year

Date Quantity

2017 5

2016 5

2015 4

Page 109: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregating (Rolling up)

SELECT SUM(s.Quantity)FROM Sales s

Page 110: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregating (Rolling up)

SELECT SUM(s.Quantity)FROM Sales s

Quantity

34

Page 111: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregating (Drilling down)

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.Name

GROUP BY t.Year, p.Brand

Page 112: Information Systems for Engineers 9. OLAP and Data Cubes

Aggregating (Drilling down)

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.Name

GROUP BY t.Year, p.BrandSales

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

Page 113: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT SUM(s.Quantity)FROM Sales s

Page 114: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT SUM(s.Quantity)FROM Sales s

Roll up

Page 115: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT SUM(s.Quantity)FROM Sales s

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

Page 116: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT SUM(s.Quantity)FROM Sales s

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

Year Quantity

2017 11

2016 14

2015 9

Page 117: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT SUM(s.Quantity)FROM Sales s

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

Year Quantity

2017 11

2016 14

2015 9

Quantity

34

Page 118: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, null, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT null, null, SUM(s.Quantity)FROM Sales s

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

Page 119: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, null, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT null, null, SUM(s.Quantity)FROM Sales s

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

Year Quantity

2017 NULL 11

2016 NULL 14

2015 NULL 9

Quantity

NULL NULL 34

Page 120: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

(SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand)UNION(SELECT t.Year, null, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year)UNION(SELECT null, null, SUM(s.Quantity)FROM Sales s)

Page 121: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

(SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand)UNION(SELECT t.Year, null, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year)UNION(SELECT null, null, SUM(s.Quantity)FROM Sales s)

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

2017 NULL 11

2016 NULL 14

2015 NULL 9

NULL NULL 34

Page 122: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.Name

GROUP BY GROUPING SETS ((t.Year, p.Brand),(t.Year),()

)

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

2017 NULL 11

2016 NULL 14

2015 NULL 9

NULL NULL 34

Page 123: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.Name

GROUP BY ROLLUP (t.Year, p.Brand)

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

2017 NULL 11

2016 NULL 14

2015 NULL 9

NULL NULL 34

Page 124: Information Systems for Engineers 9. OLAP and Data Cubes

Cross tabulation of a roll-up

Year BrandApple Samsung

2017 5 6 112016 9 5 142015 5 4 9Total 34

Page 125: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand

SELECT t.Year, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year

SELECT p.Brand, SUM(s.Quantity)FROM Sales s, Product pWHERE s.Product = p.NameGROUP BY p.Brand

SELECT SUM(s.Quantity)FROM Sales s

Page 126: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

(SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand)UNION(SELECT t.Year, null, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year)UNION(SELECT null, p.Brand, SUM(s.Quantity)FROM Sales s, Product pWHERE s.Product = p.NameGROUP BY p.Brand)UNION(SELECT null, null, SUM(s.Quantity)FROM Sales s)

Page 127: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

(SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product pWHERE s.Date = t.Date

AND s.Product = p.NameGROUP BY t.Year, p.Brand)UNION(SELECT t.Year, null, SUM(s.Quantity)FROM Sales s, Time tWHERE s.Date = t.DateGROUP BY t.Year)UNION(SELECT null, p.Brand, SUM(s.Quantity)FROM Sales s, Product pWHERE s.Product = p.NameGROUP BY p.Brand)UNION(SELECT null, null, SUM(s.Quantity)FROM Sales s)

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

2017 NULL 11

2016 NULL 14

2015 NULL 9

NULL Apple 20

NULL Samsung 14

NULL NULL 34

Page 128: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

(SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.Name

GROUP BY GROUPING SETS ((t.Year, p.Brand),(t.Year),(p.Brand),()

)

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

2017 NULL 11

2016 NULL 14

2015 NULL 9

NULL Apple 20

NULL Samsung 14

NULL NULL 34

Page 129: Information Systems for Engineers 9. OLAP and Data Cubes

Materializing all aggregates

(SELECT t.Year, p.Brand, SUM(s.Quantity)FROM Sales s, Time t, Product p

WHERE s.Date = t.DateAND s.Product = p.Name

GROUP BY CUBE (t.Year, p.Brand)

Year Brand Quantity

2017 Apple 6

2017 Samsung 5

2016 Apple 9

2016 Samsung 5

2015 Apple 5

2015 Samsung 4

2017 NULL 11

2016 NULL 14

2015 NULL 9

NULL Apple 20

NULL Samsung 14

NULL NULL 34

Page 130: Information Systems for Engineers 9. OLAP and Data Cubes

Cross tabulation (grid)

Year BrandApple Samsung

2017 5 6 112016 9 5 142015 5 4 9Total 20 14 34

Page 131: Information Systems for Engineers 9. OLAP and Data Cubes

Cross tabulation

Year BrandApple Samsung

2017 1 2 32016 3 2 52015 3 1 4Total 7 5 12

(Slicer: Peter only)

Page 132: Information Systems for Engineers 9. OLAP and Data Cubes

Cross tabulation

Customer BrandApple Samsung

Peter 1 2 3Mary 5 3 8Total 6 5 11

(Slicer: 2017)

Page 133: Information Systems for Engineers 9. OLAP and Data Cubes

MDX stands for...

Multi-DimensionaleXpressions

Page 134: Information Systems for Engineers 9. OLAP and Data Cubes

Measures

Amount of licenses

Revenues

Taxes paid

...

Page 135: Information Systems for Engineers 9. OLAP and Data Cubes

Dimensions

Quarter

Salesperson

Product

Country

Page 136: Information Systems for Engineers 9. OLAP and Data Cubes

In short...

A cube is a list of

dimensionsindexing a list of

measures

Page 137: Information Systems for Engineers 9. OLAP and Data Cubes

Hierarchies

Dimension values are organized in hierarchies.

[Location]

[Geo] [Economy]i.e., slice and aggregateby geographic region, etc

i.e., slice and aggregateby economic partnership, etc

Page 138: Information Systems for Engineers 9. OLAP and Data Cubes

Members

Members correspond to levels in a hierarchy.

[Geo][Europe] [Asia] [America]

[Switzerland][ZH][BE]

[Germany]...

[China][India]...

[Canada][USA][Brazil]...

[Africa][Ocenia]

Page 139: Information Systems for Engineers 9. OLAP and Data Cubes

Identifying a member

[Location].[Geo].[Europe].[Switzerland].[ZH].[Zurich]

Page 140: Information Systems for Engineers 9. OLAP and Data Cubes

MDX statements: dicing

SELECT[Measures].Members ON COLUMNS,[Location].[Geo].Members ON ROWS

FROM [Sales]

Page 141: Information Systems for Engineers 9. OLAP and Data Cubes

MDX statements: slicing

SELECT[Measures].Members ON COLUMNS,[Location].[Geo].Members ON ROWS

FROM [Sales]

WHERE [Products].[Line].[Laptops].[MBP]

Page 142: Information Systems for Engineers 9. OLAP and Data Cubes

Syntax

Page 143: Information Systems for Engineers 9. OLAP and Data Cubes

XBRL Architecture

Instance (.xml)

Schema (.xsd)

Linkbase (.xml)

Discoverable Taxonomy Set

Page 144: Information Systems for Engineers 9. OLAP and Data Cubes

Technologies

XML

XML SchemaXML Link

XML Names

Page 145: Information Systems for Engineers 9. OLAP and Data Cubes

Fact

<us-gaap:AssetscontextRef="FI2012Q4"decimals="-6"id="Fact-600212FD4D06E63B4F8F6874C6E5BE74"unitRef="usd">

86174000000</us-gaap:Assets>

Dimension ValueWhat? AssetsWho? Coca ColaWhen? Dec 31, 2011Of what? USD

Page 146: Information Systems for Engineers 9. OLAP and Data Cubes

Context

<xbrli:context id="FI2011Q4"><xbrli:entity>

<xbrli:identifier scheme="http://www.sec.gov/CIK">0000021344

</xbrli:identifier></xbrli:entity><xbrli:period>

<xbrli:instant>2011-12-31</xbrli:instant></xbrli:period>

</xbrli:context>December 2011

1 2 3 4

5 6 7 8 9 10 11

12 13 14 15 16 17 18

19 20 21 22 23 24 25

26 27 28 29 30 31

Page 147: Information Systems for Engineers 9. OLAP and Data Cubes

Unit

<xbrli:unit id="usd"><xbrli:measure>iso4217:USD</xbrli:measure>

</xbrli:unit>

Page 148: Information Systems for Engineers 9. OLAP and Data Cubes

Concept (XML Schema)

<xs:elementid='us-gaap_Assets'name='Assets'nillable='true'substitutionGroup='xbrli:item'type='xbrli:monetaryItemType'xbrli:balance='debit'xbrli:periodType='instant' />

Page 149: Information Systems for Engineers 9. OLAP and Data Cubes

Graphs

Page 150: Information Systems for Engineers 9. OLAP and Data Cubes

DAGs

Page 151: Information Systems for Engineers 9. OLAP and Data Cubes

Trees

Page 152: Information Systems for Engineers 9. OLAP and Data Cubes

Node: locator

<locxlink:href="http://xbrl.fasb.org/us-gaap/2013/elts/us-

gaap-2013-01-31.xsd#us-gaap_Assets"xlink:label="loc_us-

gaap_Assets_102D7A4D204ED45AC0DEDA6BBC78F386"

xlink:type="locator" />

Page 153: Information Systems for Engineers 9. OLAP and Data Cubes

Node: resource

<link:labelid="lab_ko_NetChangeInOperatingAssetsAndLiabilitiesDisclosureAbstract_A6469A522E35CBF355816876394722EE_label_en-US"xlink:label="lab_ko_NetChangeInOperatingAssetsAndLiabilitiesDisclosureAbstract_A6469A522E35CBF355816876394722EE"xlink:role="http://www.xbrl.org/2003/role/label"xlink:type="resource"xml:lang="en-US">NET CHANGE IN OPERATING ASSETS AND LIABILITIES

DISCLOSURE [Abstract]</link:label>

Page 154: Information Systems for Engineers 9. OLAP and Data Cubes

Edge

<presentationArcorder="10"preferredLabel="http://www.xbrl.org/2003/role/totalLabel"xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child"xlink:from="loc_us-

gaap_AssetsAbstract_2F55ECB2BF7C1A62009CDA6BBC757094"xlink:to="loc_us-

gaap_Assets_102D7A4D204ED45AC0DEDA6BBC78F386"xlink:type="arc" />

Page 155: Information Systems for Engineers 9. OLAP and Data Cubes

Summary

Page 156: Information Systems for Engineers 9. OLAP and Data Cubes

Architecture

ERP

CRM

OLTP

ETL

Files

Analyze

Report

Mine