UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

34
1 UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY Lecture 3: Data Warehousing TIES443: Introduction to DM 1 Lecture 3 Lecture 3 Data Warehousing Data Warehousing Department of Mathematical Information Technology University of Jyväskylä Mykola Pechenizkiy Course webpage: http://www.cs.jyu.fi/~mpechen/TIES443 TIES443 November 3, 2006 UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY Lecture 3: Data Warehousing TIES443: Introduction to DM 2 Topics for today Topics for today What is a data warehouse? Data warehouse architectures Conceptual DW Modelling Physical DW Modelling A multi-dimensional data model Data Cubes • OLAP 12 Codd’s rules for OLAP Main OLAP operations New buzzwords Data warehouse implementation and maintenance

Transcript of UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

Page 1: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

1

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 1

Lecture 3Lecture 3

Data WarehousingData Warehousing

Department of Mathematical Information TechnologyUniversity of Jyväskylä

Mykola Pechenizkiy

Course webpage: http://www.cs.jyu.fi/~mpechen/TIES443

TIES443

November 3, 2006

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 2

Topics for todayTopics for today

• What is a data warehouse?

• Data warehouse architectures– Conceptual DW Modelling

– Physical DW Modelling

• A multi-dimensional data model– Data Cubes

• OLAP– 12 Codd’s rules for OLAP

– Main OLAP operations

• New buzzwords

• Data warehouse implementation and maintenance

Page 2: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

2

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 3

Data WarehouseData Warehouse

A decision support DB that is maintained separatelyfrom the organization’s operational databases.

Why Separate Data Warehouse?• High performance for both systems

– DBMS— tuned for OLTP • access methods, indexing, concurrency control, recovery

– Warehouse—tuned for OLAP • complex OLAP queries, multidimensional view, consolidation.

• Different functions and different data– Missing data: Decision support requires historical data which

operational DBs do not typically maintain– Data consolidation: DS requires consolidation (aggregation,

summarization) of data from heterogeneous sources– Data quality: different sources typically use inconsistent data

representations, codes and formats which have to be reconciled

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 4

ThreeThree--Tier ArchitectureTier Architecture

DataWarehouse

ExtractTransformLoadRefresh

OLAP Engine

Monitor&

IntegratorMetadata

Data Sources Front-End Tools

Serve

Data Marts

Operational

DBs

other

sources

Data Storage

OLAP Server

Analysis

Query/Reporting

Data Mining

ROLAPServer

Page 3: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

3

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 5

ThreeThree--Tier Tier ArchitectureArchitecture• Warehouse database server

– Almost always a relational DBMS, rarely flat files– Schema design– Specialized scan, indexing and join techniques– Handling of aggregate views (querying and materialization)– Supporting query language extensions beyond SQL– Complex query processing and optimization– Data partitioning and parallelism

• OLAP servers– Relational OLAP (ROLAP): extended relational DBMS that maps operations on

multidimensional data to standard relational operators– Multidimensional OLAP (MOLAP): special-purpose server that directly

implements multidimensional data and operations

– Hybrid OLAP (HOLAP): user flexibility, e.g., low level: relational, high-level: array

– Specialized SQL servers: specialized support for SQL queries over star/snowflake schemas

• Clients– Query and reporting tools– Analysis tools– Data mining tools

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 6

Warehouse Physical ArchitecturesWarehouse Physical Architectures

CentralData

Warehouse

Client Client Client

Source Source

Centralized architecture

LogicalData

Warehouse

Source Source

Federated architecture

PhysicalData

Warehouse

Source Source

Tiered architecture

Page 4: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

4

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 7

Three Data Warehouse ModelsThree Data Warehouse Models

• Enterprise warehouse: collects all information about subjects (customers,products,sales,assets, personnel) that span the entire organization– Requires extensive business modeling (may take years to design

and build)

• Data Marts: Departmental subsets that focus on selected subjects– Marketing data mart: customer, product, sales

– Faster roll out, but complex integration in the long run

• Virtual warehouse: views over operational DBs – Materialize selective summary views for efficient query processing

– Easy to build but require excess capability on operat. db servers

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 8

Page 5: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

5

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 9

Data WarehouseData Warehouse

• A data warehouse is a

– subject-oriented,

– integrated,

– time-varying,

– non-volatile

collection of data that is used primarily in organizational

decision making

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 10

Data WarehouseData Warehouse——SubjectSubject--OrientedOriented

• Organized around major subjects, such as customer,

product, sales

• Focusing on the modeling and analysis of data for

decision makers, not on daily operations or transaction

processing

• Provide a simple and concise view around particular

subject issues by excluding data that are not useful in the

decision support process

Page 6: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

6

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 11

Data WarehouseData Warehouse——IntegratedIntegrated

• Constructed by integrating multiple, heterogeneous data sources– relational databases, flat files, on-line transaction records

• Data cleaning and data integration techniques are applied– Ensure consistency in naming conventions, encoding

structures, attribute measures, etc. among different data sources• E.g., Hotel price: currency, tax, breakfast covered, etc.

– When data is moved to the warehouse, it is converted

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 12

Data WarehouseData Warehouse——Time VariantTime Variant

• The time horizon for the data warehouse is significantly

longer than that of operational systems

– Operational database: current value data

– Data warehouse data: provide information from a historical

perspective (e.g., past 5-10 years)

• Every key structure in the data warehouse

– Contains an element of time, explicitly or implicitly

– But the key of operational data may or may not contain “time

element”

Page 7: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

7

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 13

• A physically separate store of data transformed from

the operational environment

• Operational update of data does not occur in the data

warehouse environment

– Does not require transaction processing, recovery, and

concurrency control mechanisms

– Requires only two operations in data accessing:

initial loading of data and access of data

Data WarehouseData Warehouse——NonNon--VolatileVolatile

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 14

Data Warehouse vs. Heterogeneous DBMSData Warehouse vs. Heterogeneous DBMS

• Traditional heterogeneous DB integration– Build wrappers/mediators on top of heterogeneous databases

– Query driven approach

• When a query is posed to a client site, a meta-dictionary is used to translate the query into queries appropriate for individual heterogeneous sites involved, and the results are integrated into a global answer set

• Complex information filtering, compete for resources

• Data warehouse– update-driven, high performance

– Information from heterogeneous sources is integrated in advance and stored in warehouses for direct query and analysis

Page 8: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

8

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 15

Data Warehouse vs. Operational DBMSData Warehouse vs. Operational DBMS

• OLTP (On-Line Transaction Processing)

– Major task of traditional relational DBMS

– Day-to-day operations: purchasing, inventory, banking, manufacturing,

payroll, registration, accounting, etc.

• OLAP (On-Line Analytical Processing)

– Major task of data warehouse system

– Data analysis and decision making

• Distinct features (OLTP vs. OLAP):

– User and system orientation: customer vs. market

– Data contents: current, detailed vs. historical, consolidated

– Database design: ER + application vs. star + subject

– View: current, local vs. evolutionary, integrated

– Access patterns: update vs. read-only but complex queries

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 16

• ER design techniques not appropriate - design should reflect multidimensional view

– Star Schema• A fact table in the middle connected to a set of dimension tables

– Snowflake Schema

• A refinement of star schema where some dimensional hierarchy is normalized into a set of smaller dimension tables, forming a shape similar to snowflake

– Fact Constellation Schema

• Multiple fact tables share dimension tables, viewed as a collection

of stars, therefore called galaxy schema or fact constellation

Conceptual Modeling of Data WarehousesConceptual Modeling of Data Warehouses

Page 9: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

9

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 17

Example of a Star SchemaExample of a Star Schema

Order NoOrder No

Order DateOrder Date

Customer NoCustomer No

Customer NameCustomer Name

Customer Customer

AddressAddress

CityCity

SalespersonIDSalespersonID

SalespersonNameSalespersonName

CityCity

QuotaQuota

OrderNOOrderNO

SalespersonIDSalespersonID

CustomerNOCustomerNO

ProdNoProdNo

DateKeyDateKey

CityNameCityName

QuantityQuantity

Total Price

ProductNOProductNO

ProdNameProdName

ProdDescrProdDescr

CategoryCategory

CategoryDescriptionCategoryDescription

UnitPriceUnitPrice

DateKeyDateKey

DateDate

CityNameCityName

StateState

CountryCountry

OrderOrder

CustomerCustomer

SalespersonSalesperson

CityCity

DateDate

ProductProduct

Fact TableFact Table

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 18

Star SchemaStar Schema

• A single fact table and a single table for each dimension

• Every fact points to one tuple in each of the dimensions and has additional attributes

• Does not capture hierarchies directly

• Generated keys are used for performance and maintenance reasons

• Fact constellation: Multiple Fact tables that share many dimension tables– Example: Projected expense and the actual expense may share

dimensional tables

Page 10: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

10

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 19

• Relation, which relates the dimensions to the measure of interest, is called the fact table (e.g. sale)

• Information about dimensions can be represented as a collection of relations – called the dimension tables(product, customer, store)

• Each dimension can have a set of associated attributes

• For each dimension, the set of associated attributes can be structured as a hierarchy

Some TermsSome Terms

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 20

A Concept Hierarchy: Dimension (location)A Concept Hierarchy: Dimension (location)

all

North_America Europe

FranceIrelandMexicoCanada

Dublin

BlackrockBelfield

...

......

... ...

...

allall

regionregion

officeoffice

countrycountry

BelfastTorontocitycity

Page 11: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

11

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 21

Example of a Snowflake SchemaExample of a Snowflake Schema

Order NoOrder No

Order DateOrder Date

Customer NoCustomer No

Customer NameCustomer Name

Customer Customer

AddressAddress

CityCity

SalespersonIDSalespersonID

SalespersonNameSalespersonName

CityCity

QuotaQuota

OrderNOOrderNO

SalespersonIDSalespersonID

CustomerNOCustomerNO

ProdNoProdNo

DateKeyDateKey

CityNameCityName

QuantityQuantity

Total Price

ProductNOProductNO

ProdNameProdName

ProdDescrProdDescr

CategoryCategory

CategoryCategory

UnitPriceUnitPrice

DateKeyDateKey

DateDate

MonthMonth

CityNameCityName

StateState

CountryCountry

OrderOrder

CustomerCustomer

SalespersonSalesperson

CityCity

DateDate

ProductProduct

Fact TableFact Table

CategoryNameCategoryName

CategoryDescrCategoryDescr

MonthMonth

YearYearYearYear

StateNameStateName

CountryCountry

CategoryCategory

StateState

MonthMonth

YearYear

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 22

branch_keybranch_namebranch_type

time_keydayday_of_the_weekmonthquarteryear

Measures

Branch

Time

item_keyitem_namebrandtypesupplier_key

Item

location_keystreetcityProvince/streetcountry

Location

Sales Fact Table

Avg_sales

Euros_sold

Unit_sold

Location_key

Branch_key

Item_key

Time_key

shipper_keyshipper_namelocation_keyshipper_type

shipper

unit_shipped

Euros_sold

to_location

from_location

shipper_key

Item_key

Time_key

Shipping Fact TableMultiple fact tables share dimension tables

Example of Fact ConstellationExample of Fact Constellation

Page 12: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

12

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 23

sale Product Client Amtp1 c1 12p2 c1 11p1 c3 50p2 c2 8

c1 c2 c3p1 12 50p2 11 8

Fact relation Two-dimensional cube

sale Product Client Date Amtp1 c1 1 12p2 c1 1 11p1 c3 1 50p2 c2 1 8p1 c1 2 44p1 c2 2 4

day 2 c1 c2 c3p1 44 4p2 c1 c2 c3

p1 12 50p2 11 8

day 1

Fact relation 3-dimensional cube

MultidimensionalMultidimensional Data ModelData Model

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 24

Multidimensional DataMultidimensional Data

• Sales volume as a function of product, month, and region

Pro

duct

Regio

n

Month

Dimensions: Product, Location, TimeHierarchical summarization paths

Industry Region Year

Category Country Quarter

Product City Month Week

Office Day

Page 13: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

13

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 25

From Tables to Data CubesFrom Tables to Data Cubes

• A data warehouse is based on

– multidimensional data model which views data in the form of a data cube

• A data cube allows data to be modeled and viewed in multiple dimensions (such as sales)

– Dimension tables, such as item (item_name, brand, type), or time(day, week, month, quarter, year)

– Fact table contains measures (such as dollars_sold) and keys to each of the related dimension tables

• Definitions

– an n-Dimensional base cube is called a base cuboid

– The top most 0-D cuboid, which holds the highest-level of summarization, is called the apex cuboid

– The lattice of cuboids forms a data cube

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 26

all

time item location supplier

time,item time,location

time,supplier

item,location

item,supplier

location,supplier

time,item,location

time,item,supplier

time,location,supplier

item,location,supplier

time, item, location, supplier

00--D(apex) D(apex) cuboidcuboid

11--D cuboidsD cuboids

22--D cuboidsD cuboids

33--D cuboidsD cuboids

44--D(base) D(base) cuboidcuboid

Cube: A Lattice of CuboidsCube: A Lattice of Cuboids

Page 14: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

14

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 27

A Sample Data CubeA Sample Data Cube

Total annual salesof TV in IrelandDate

Produ

ct

Cou

ntrysum

sumTV

VCRPC

1Qtr 2Qtr 3Qtr 4Qtr

Ireland

France

Germany

sum

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 28

• Roll up (drill-up): summarize data

– by climbing up hierarchy or by dimension reduction

• Drill down (roll down): reverse of roll-up

– from higher level summary to lower level summary or detailed data, or

introducing new dimensions

• Slice and dice

– project and select

• Pivot (rotate)

– reorient the cube, visualization, 3D to series of 2D planes.

• Other operations

– drill across: involving (across) more than one fact table

– drill through: through the bottom level of the cube to its back-end relational

tables (using SQL)

– rankings

– time functions: e.g. time avg.

Typical OLAP OperationsTypical OLAP Operations

Page 15: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

15

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 29

Total SalesTotal Sales per cityTotal Sales per city per storeTotal Sales per city per store per month

DrillDown

DrillUp

Total SalesTotal Sales per cityTotal Sales per city by category

DrillDown

DrillUp

Drill Across

Typical OLAP Operations: Drill & RollTypical OLAP Operations: Drill & Roll

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 30

day 2 c1 c2 c3p1 44 4p2 c1 c2 c3

p1 12 50p2 11 8

c1 c2 c3p1 56 4 50p2 11 8

c1 c2 c3sum 67 12 50

sump1 110p2 19

129

drill-down

rollup

day 1

OLAP Queries: Rollup & DrillOLAP Queries: Rollup & Drill--DownDown

Page 16: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

16

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 31

• Pivoting can be combined with aggregation

sale prodId clientid date amtp1 c1 1 12p2 c1 1 11p1 c3 1 50p2 c2 1 8p1 c1 2 44p1 c2 2 4

day 2 c1 c2 c3p1 44 4p2 c1 c2 c3

p1 12 50p2 11 8

day 1

c1 c2 c3 Sump1 56 4 50 110p2 11 8 19

Sum 67 12 50 129

c1 c2 c3 Sum1 23 8 50 812 44 4 48

Sum 67 12 50 129

The result of pivoting is called a cross-tabulation

Typical OLAP Operations: PivotingTypical OLAP Operations: Pivoting

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 32

Browsing a Data CubeBrowsing a Data Cube

• Visualization

• OLAP capabilities

• Interactive

manipulation

Page 17: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

17

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 33

12 12 CoddCodd’’ss Rules for OLAPRules for OLAP

1. Multi-Dimensional Concept View– The user should be able to see the data as being multidimensional insofar as it

should be easy to 'pivot' or 'slice and dice’. (See later.)

2. Transparency– The OLAP functionality should be provided behind the user's existing

software without adversely affecting the functionality of the 'host‘, i.e. OLAP server should shield the user for the complexity of the data and application

3. Accessibility– OLAP should allow the user to access diverse data stores (relational,

nonrelational and legacy systems) but see the data within a common 'schema‘ provided by the OLAP tool, i.e. Users shouldn’t have to know the location, type or layout of the data to access it.

– OLAP server should automate the mapping of the logical schema to the physical data

4. Consistent Reporting Performance– There should not be significant degradation in performance with large

numbers of dimensions or large quantities of data.

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 34

12 12 CoddCodd’’ss Rules for OLAPRules for OLAP

5. Client-Server Architecture– Since much of the data is on mainframes, and the users work on

PCs, the OLAP tool must be able to bring the two together

– Different clients can be used

– Data sources must be transparently supported by the OLAP server

6. Generic Dimensionality– Data dimensions must all be treated equally. Functions available

for one dimension must be available for others.

7. Dynamic Sparse Matrix Handling– The OLAP tool should be able to work out for itself the most

efficient way to store sparse matrix data.

8. Multi User Support– access, integrity, security

Page 18: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

18

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 35

12 12 CoddCodd’’ss Rules for OLAPRules for OLAP9. Unrestricted Cross-Dimensional Operations

– e.g., individual office overheads are allocated according to total corporate overheads divided in proportion to individual office sales.

– Non-additive formulas cause the problems• Contribution = Revenue - Total Costs• Margin Percentage = Margin / Revenue

10. Intuitive Data Manipulation– Navigation should be done by operations on individual cells rather than

menus.– Dimensions defined should allow automatic reorientation, drill-down,

zoom-out, etc– Interface must be intuitive

11. Flexible Reporting– Row and column headings must be capable of more than one dimension

each, and of displaying subsets of any dimension.12. Unlimited Dimensions and Aggregation Levels

– 15 - 20 dimensions are required in modelling, and within each there may be many hierarchical levels, i.e. unlimited aggregation

– Rare in reporting to go beyond 12 dimensions, 6-7 is usual

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 36

DW BackDW Back--End Tools and UtilitiesEnd Tools and Utilities

• Data extraction:– get data from multiple, heterogeneous, and external sources

• Data cleaning:– detect errors in the data and rectify them when possible

• Data transformation:– convert data from legacy or host format to warehouse format:

different data formats, languages, etc.

• Load:– sort, summarize, consolidate, compute views, check integrity, and

build indicies and partitions

• Refresh– propagate the updates from the data sources to the warehouse

Page 19: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

19

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 37

DW Information FlowsDW Information Flows

• INFLOW - Processes associated with the extraction, cleansing, and loading of the data from the source systems into the data warehouse.

• UPFLOW - Processes associated with adding value to the data in the warehouse through summarizing, packaging, and distribution of the data.

• DOWNFLOW - Processes associated with archiving and backing-up/recovery of data in the warehouse.

• OUTFLOW - Processes associated with making the data available to the end-users.

• METAFLOW - Processes associated with the management of the metadata.

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 38

Data CleaningData Cleaning

• why?– Data warehouse contains data that is analyzed for business

decisions

– More data and multiple sources could mean more errors in the data and harder to trace such errors

– Results in incorrect analysis

• finding and resolving inconsistency in the source data

• detecting data anomalies and rectifying them early has huge payoffs

• Important to identify tools that work together well

• Long Term Solution– Change business practices and data entry tools

– Repository for meta-data

Page 20: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

20

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 39

Data Cleaning TechniquesData Cleaning Techniques

• Transformation Rules– Example: translate “gender” to “sex”

• Uses domain-specific knowledge to do scrubbing

• Parsing and fuzzy matching– Multiple data sources (can designate a preferred

source)

• Discover facts that flag unusual patterns (auditing)– Some dealer has never received a single complaint

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 40

LoadLoad

• Issues:– huge volumes of data to be loaded

– small time window (usually at night) when the warehouse can be taken off-line

– When to build indexes and summary tables

– allow system administrator to monitor status, cancel suspend, resume load, or change load rate

– restart after failure with no loss of data integrity

• Techniques:– batch load utility: sort input records on clustering key and use

sequential I/O; build indexes and derived tables

– sequential loads still too long (~100 days for TB)

– use parallelism and incremental techniques

Page 21: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

21

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 41

RefreshRefresh

• when to refresh– on every update: too expensive, only necessary if OLAP queries

need current data (e.g., up-the-minute stock quotes)

– periodically (e.g., every 24 hours, every week) or after “significant” events

– refresh policy set by administrator based on user needs and traffic

– possibly different policies for different sources

• how to refresh– Full extract from base tables

• read entire source table or database: expensive

– Incremental techniques • detect & propagate changes on base tables: replication servers

• logical correctness

• transactional correctness: incremental load

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 42

Metadata RepositoryMetadata Repository• Administrative metadata

– source databases and their contents– warehouse schema, view & derived data definitions– dimensions, hierarchies– pre-defined queries and reports– data mart locations and contents– data partitions– data extraction, cleansing, transformation rules, defaults– data refresh and purging rules– user profiles, user groups– security: user authorization, access control

• Business data– business terms and definitions– ownership of data– charging policies

• Operational metadata– data lineage: history of migrated data and sequence of transf-s applied– currency of data: active, archived, purged– monitoring information: warehouse usage statistics, error reports, audit

trails.

Page 22: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

22

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 43

Design of a DW: A Business Analysis FrameworkDesign of a DW: A Business Analysis Framework

• Four views regarding the design of a data warehouse – Top-down view: allows selection of the relevant

information necessary for the data warehouse (mature)

– Bottom-up: Starts with experiments and prototypes (rapid)

– Data source view

• exposes the information being captured, stored, and managed by operational systems

– Data warehouse view

• consists of fact tables and dimension tables

– Business query view

• sees the perspectives of data in the warehouse from the view of end-user

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 44

Data Warehouse Design ProcessData Warehouse Design Process

• From software engineering point of view– Waterfall: structured and systematic analysis at each step before

proceeding to the next

– Spiral: rapid generation of increasingly functional systems, short turn around time, quick turn around

• Typical data warehouse design process– Choose a business process to model, e.g., orders, invoices, etc.

– Choose the grain (atomic level of data) of the business process

– Choose the dimensions that will apply to each fact table record

– Choose the measure that will populate each fact table record

Page 23: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

23

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 45

DW Design: Issues to ConsiderDW Design: Issues to Consider

• What data is needed?

• Where does it come from?

• How to clean data?

• How to represent in warehouse (schema)?

• What to summarize?

• What to materialize?

• What to index?

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 46

DW Data Management: Issues to Consider

• Meta-data

• Data sourcing

• Data quality

• Data security

• Granularity

• History- how long and how much?

• Performance

Page 24: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

24

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 47

Common DW ProblemsCommon DW Problems

• Underestimation of resources for data loading

• Hidden problems with source systems

• Required data not captured

• Increased end-user demands

• Data homogenization

• High demand for resources

• Data ownership

• High maintenance

• Long duration projects

• Complexity of integration

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 48

Research IssuesResearch Issues• Data cleaning

– focus on data inconsistencies, not schema differences– data mining techniques

• Physical Design– design of summary tables, partitions, indexes– tradeoffs in use of different indexes

• Query processing– selecting appropriate summary tables– dynamic optimization with feedback– query optimization: cost estimation, use of transformations, search

strategies– partitioning query processing between OLAP server and backend server.

• Warehouse Management– incremental refresh techniques– computing summary tables during load– failure recovery during load and refresh– process management: scheduling queries, load and refresh– use of workflow technology for process management

Page 25: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

25

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 49

OLAP Mining: An Integration of DM and DWOLAP Mining: An Integration of DM and DW

• Data mining systems, DBMS, Data warehouse systems

coupling

– No coupling, loose-coupling, semi-tight-coupling, tight-coupling

• On-line analytical mining data

– integration of mining and OLAP technologies

• Interactive mining multi-level knowledge

– Necessity of mining knowledge and patterns at different levels of

abstraction by drilling/rolling, pivoting, slicing/dicing, etc.

• Integration of multiple mining functions

– Characterized classification, first clustering and then association

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 50

• What is a data warehouse

• Data warehouse architectures– Conceptual DW Modelling

– Physical DW Modelling

• A multi-dimensional data model– Data Cubes

– Main OLAP operations

• Data warehouse implementation and maintenance

SummarySummary

What else did you get from this lecture?What else did you get from this lecture?

Page 26: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

26

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 51

Additional SlidesAdditional Slides

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 52

Some Critics for Data CubesSome Critics for Data Cubes

• Jargon for IT professionals

• Metaphor for end-users

– Not useful beyond introduction

– Users expect to see one

– Rubic’s cube

• Easy to manipulate but difficult to solve

• Alternatives are better

– Cognos’ ways, Thomsen’s multi-dimensional domain diagrams,

Bulos’s Adapt diagrams or simply well designed interactive

reports

Page 27: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

27

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 53

DW Development: A Recommended ApproachDW Development: A Recommended Approach

Define a high-level corporate data model

Data Mart

Data Mart

Distributed Data Marts

Multi-Tier Data Warehouse

Enterprise Data Warehouse

Model refinementModel refinement

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 54

DMQL: Language PrimitivesDMQL: Language Primitives

• Cube Definition (Fact Table)– define cube <cube_name> [<dimension_list>]:

<measure_list>

• Dimension Definition (Dimension Table)– define dimension <dimension_name> as

(<attribute_or_subdimension_list>)

• Special Case (Shared Dimension Tables)– First time as “cube definition”

– define dimension <dimension_name> as <dimension_name_first_time> in cube<cube_name_first_time>

Nice presentation on Data Mining Query Languages can be found here: http://www.cs.wisc.edu/EDAM/slides/Data%20Mining%20Query%20Languages.ppt

Page 28: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

28

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 55

Defining a Star Schema in DMQLDefining a Star Schema in DMQL

define cube sales_star [time, item, branch, location]:dollars_sold = sum(sales_in_dollars),

avg_sales = avg(sales_in_dollars),

units_sold = count(*)

define dimension time as

(time_key, day, day_of_week, month, quarter, year)

define dimension item as (item_key, item_name, brand, type, supplier_type)

define dimension branch as (branch_key, branch_name, branch_type)

define dimension location as(location_key, street, city, province_or_state, country)

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 56

Defining a Snowflake Schema in DMQLDefining a Snowflake Schema in DMQL

define cube sales_snowflake [time, item, branch, location]:

dollars_sold = sum(sales_in_dollars),

avg_sales = avg(sales_in_dollars),

units_sold = count(*)

define dimension time as

(time_key, day, day_of_week, month, quarter, year)

define dimension item as

(item_key, item_name, brand, type, supplier(supplier_key, supplier_type))

define dimension branch as

(branch_key, branch_name, branch_type)

define dimension location as

(location_key, street, city(city_key, province_or_state, country))

Page 29: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

29

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 57

Defining a Fact Constellation in DMQLDefining a Fact Constellation in DMQL

define cube sales [time, item, branch, location]:dollars_sold = sum(sales_in_dollars), avg_sales = avg(sales_in_dollars), units_sold = count(*)

define dimension time as (time_key, day, day_of_week, month, quarter, year)

define dimension item as (item_key, item_name, brand, type, supplier_type)

define dimension branch as (branch_key, branch_name, branch_type)

define dimension location as (location_key, street, city, province_or_state, country)

define cube shipping [time, item, shipper, from_location, to_location]:dollar_cost = sum(cost_in_dollars), unit_shipped = count(*)

define dimension time as time in cube sales

define dimension item as item in cube sales

define dimension shipper as (shipper_key, shipper_name, location as location in cube sales, shipper_type)

define dimension from_location as location in cube sales

define dimension to_location as location in cube sales

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 58

A StarA Star--Net Query ModelNet Query Model

Shipping Method

AIR-EXPRESS

TRUCKORDER

Customer Orders

CONTRACTS

Customer

Product

PRODUCT GROUP

PRODUCT LINE

PRODUCT ITEM

SALES PERSON

DISTRICT

DIVISION

OrganizationPromotion

CITY

COUNTRY

REGION

Location

DAILYQTRLYANNUALYTime

Each circle is called a footprint

Page 30: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

30

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 59

Index StructuresIndex Structures

• Indexing principle: • mapping key values to records for associative direct access

• Most popular indexing techniques in relational database: B+-trees

• For multi-dimensional data, a large number of indexing techniques have been developed: R-trees

• Index structures applied in warehouses– inverted lists

– bit map indexes

– join indexes

– text indexes

This and the following slides on Indexing for DW are adopted with minor modifications from: http://infolab.stanford.edu/~hector/cs245/Notes12.ppt

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 60

Inverted ListsInverted Lists

• Query: – Get people with age = 20 and

name = “fred”

2023

1819

202122

232526

r4r18r34r35

r5r19r37r40

rId name ager4 joe 20

r18 fred 20r19 sally 21r34 nancy 20r35 tom 20r36 pat 25r5 dave 21

r41 jeff 26

. . .

ageindex

invertedlists

datarecords

List for age = 20: r4, r18, r34, r35List for name = “fred”: r18, r52Answer is intersection: r18

Page 31: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

31

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 61

Bitmap IndexesBitmap Indexes

• Bitmap index: An indexing technique that has attracted attention in multi-dimensional database implementation

table

Customer City Carc1 Detroit Fordc2 Chicago Hondac3 Detroit Hondac4 Poznan Fordc5 Paris BMWc6 Paris Nissan

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 62

Bitmap IndexesBitmap Indexes• The index consists of bitmaps:

Index on City:

bitmaps

ec1 Chicago Detroit Paris Poznan1 0 1 0 02 1 0 0 03 0 1 0 04 0 0 0 15 0 0 1 06 0 0 1 0

ec1 BMW Ford Honda Nissan1 0 1 0 02 1 0 1 03 0 0 1 04 0 1 0 05 1 0 0 06 0 0 0 1

Index on Car:

bitmaps

•Index on a particular column•Index consists of a number of bit vectors - bitmaps•Each value in the indexed column has a bit vector (bitmaps)•The length of the bit vector is the number of records in the base table•The i-th bit is set if the i-th row of the base table has the value for the indexed column

Page 32: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

32

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 63

• Index on a particular column

• Index consists of a number of bit vectors - bitmaps

• Each value in the indexed column has a bit vector (bitmaps)

• The length of the bit vector is the number of records in the base table

• The i-th bit is set if the i-th row of the base table has the value for the indexed column

Bitmap IndexesBitmap Indexes

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 64

Bitmap IndexBitmap Index

2023

1819

202122

232526

id name age1 joe 202 fred 203 sally 214 nancy 205 tom 206 pat 257 dave 218 jeff 26

. . .

ageindex

bitmaps

datarecords

110110000

0010001011

Query: Get people with age = 20 and name = “fred”

List for age = 20: 1101100000List for name = “fred”: 0100000001Answer is intersection: 0100000000

Suited well for domains with small cardinality

Page 33: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

33

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 65

• With efficient hardware support for bitmap operations (AND, OR, XOR, NOT), bitmap index offers better access methods for certain queries

• e.g., selection on two attributes

• Some commercial products have implementedbitmap index

• Works poorly for high cardinality domains since the number of bitmaps increases

• Difficult to maintain - need reorganization when relation sizes change (new bitmaps)

Bitmap Index Bitmap Index –– SummarySummary

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 66

• “Combine” SALE, PRODUCT relations

• In SQL: SELECT * FROM SALE, PRODUCT

sale prodId storeId date amtp1 c1 1 12p2 c1 1 11p1 c3 1 50p2 c2 1 8p1 c1 2 44p1 c2 2 4

product id name pricep1 bolt 10p2 nut 5

joinTb prodId name price storeId date amtp1 bolt 10 c1 1 12p2 nut 5 c1 1 11p1 bolt 10 c3 1 50p2 nut 5 c2 1 8p1 bolt 10 c1 2 44p1 bolt 10 c2 2 4

JoinJoin

Page 34: UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL ...

34

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 67

Join IndexesJoin Indexes

product id name price jIndexp1 bolt 10 r1,r3,r5,r6p2 nut 5 r2,r4

sale rId prodId storeId date amtr1 p1 c1 1 12r2 p2 c1 1 11r3 p1 c3 1 50r4 p2 c2 1 8r5 p1 c1 2 44r6 p1 c2 2 4

join index

UNIVERSITY OF JYVÄSKYLÄ DEPARTMENT OF MATHEMATICAL INFORMATION TECHNOLOGY

Lecture 3: Data WarehousingTIES443: Introduction to DM 68

Join IndexesJoin Indexes

• Traditional indexes map the value to a list of record ids. Join indexes map the tuples in the join result of two relations to the source tables.

• In data warehouse cases, join indexes relate the values of the dimensions of a star schema to rows in the fact table.

• For a warehouse with a Sales fact table and dimension city, a join index on city maintains for each distinct city a list of

RIDs of the tuples recording the sales in the city

• Join indexes can span multiple dimensions