56
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 16 Data Warehouse Technology and Management

Chapter 16

Embed Size (px)

DESCRIPTION

Chapter 16. Data Warehouse Technology and Management. Outline. Basic concepts and characteristics Business architectures and applications Data cube concepts and operators Relational DBMS features Maintaining a data warehouse. Comparison of Environments. Transaction processing - PowerPoint PPT Presentation

Citation preview

Page 1: Chapter 16

McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved.

Chapter 16

Data Warehouse Technology and Management

Page 2: Chapter 16

16-2

Outline

Basic concepts and characteristics Business architectures and applications Data cube concepts and operators Relational DBMS features Maintaining a data warehouse

Page 3: Chapter 16

16-3

Comparison of Environments Transaction processing

Uses operational databases Short-term decisions: fulfill orders, resolve

complaints, provide staffing Decision support processing

Uses integrated and summarized data Medium and long-term decisions: capacity

planning, store locations, new lines of business

Page 4: Chapter 16

16-4

Definition and Characteristics A central repository for summarized and

integrated data from operational databases and external data sources

Key Characteristics Subject-oriented Integrated Time-variant Nonvolatile

Page 5: Chapter 16

16-5

Data ComparisonCharacteristic Operational

Database Data Warehouse

Currency Current Historical

Detail level Individual Individual and Summary

Orientation Process orientation

Subject orientation

Number of records processed

Few Thousands

Normalization level Mostly normalized

Mostly denormalized

Update level Volatile Nonvolatile (refreshed)

Data model Relational Multidimensional and relational with star schemas

Page 6: Chapter 16

16-6

Architectures and Applications Data warehouse projects Top-down architectures Bottom-up architecture Applications and data mining

Page 7: Chapter 16

16-7

Data Warehouse Projects Large efforts with much coordination

across departments Enterprise data model

Important artifact of data warehouse project Structure of data model Meta data for data transformation

Top-down vs. bottom-up business architectures

Page 8: Chapter 16

16-8

Two Tier Architecture

Data warehouse

Operationaldatabase

Operationaldatabase

External data source

EDM

Detailed and summarized data

Transformation process

Data warehouse server

User departments

Page 9: Chapter 16

16-9

Three Tier Architecture

Data warehouse

Operationaldatabase

Operationaldatabase

External data source

EDM

Detailed and summarized data

Transformation process

Data warehouse server

User departments

Data mart

Data mart

Data mart tier

Extraction process

Page 10: Chapter 16

16-10

Bottom-up Architecture

Operationaldatabase

Operationaldatabase

Externaldata source

Transformationprocess

Userdepartments

Data mart

Data mart

Data mart tier

Page 11: Chapter 16

16-11

Applications

Industry Key Applications Airline Yield management,

route assessment Telecommunications Customer retention,

network design Insurance Risk assessment, product

design, fraud detection Retail Target marketing,

supply-chain management

Page 12: Chapter 16

16-12

Maturity Model Guidance for investment decisions Stages provide a framework to view an

organization’s progress Insights: difficulty moving between stages

Infant to child stages because of investment level

Teenager to adult because of strategic importance of data warehouse

Page 13: Chapter 16

16-13

Data Mining Discover significant, implicit patterns

Target promotions Change mix and collocation of items

Requires large volumes of transaction data

Important application for data warehouses

Page 14: Chapter 16

16-14

Data Cube Concepts and Operators Basics Dimension and measure details Operators

Page 15: Chapter 16

16-15

Data Cube Basics Multidimensional arrangement of data Users think about decision support data as

data cubes Terminology

Dimension: subject label for a row or column Member: value of dimension Measure: quantitative data stored in cells

Page 16: Chapter 16

16-16

Data Cube Example

Product

Mono Ink Photo Portable Laser Jet

Lo

cati

on California

Utah

Arizona

Washington

Colorado Time 1/1/2006 1/2/2006

….. 12/31/2006

80 110 60 25

40 90 50 30

70 55 60 35

75 85 45 45

65 45 85 60

Page 17: Chapter 16

16-17

Dimensions and Measures Dimensions

Hierarchies: members can have sub members Sparsity: many cells do not have data

Measures Derived measures Multiple measures in cells

Page 18: Chapter 16

16-18

Time Series Data Common data type in trend analysis Reduce dimensionality using time series Time series properties

Data type Start date Calendar Periodicity Conversion

Page 19: Chapter 16

16-19

Slice Operator Focus on a subset of dimensions Set dimension to specific value: 1/1/2006

Location Product Mono Laser Ink Jet Photo Portable

California 80 110 60 25 Utah 40 90 50 30 Arizona 70 55 60 35 Washington 75 85 45 45 Colorado 65 45 85 60

Page 20: Chapter 16

16-20

Dice Operator

Focus on a subset of member values Replace dimension with a subset of values Dice operation often follows a slice

operation

Product

Mono Ink Photo Portable Laser Jet L

ocat

ion Utah 40 90 50 30

Page 21: Chapter 16

16-21

Other Operators Operators for hierarchical dimensions

Drill-down: add detail to a dimension Roll-up: remove detail from a dimension Recalculate measure values

Pivot: rearrange dimensions

Page 22: Chapter 16

16-22

Operator Summary

Operator Purpose Description

Slice Focus attention on a subset of dimensions

Replace a dimension with a single member value or with a summary of its measure values

Dice Focus attention on a subset of member values

Replace a dimension with a subset of members

Drill-down Obtain more detail about a dimension

Navigate from a more general level to a more specific level

Roll-up Summarize details about a dimension

Navigate from a more specific level to a more general level

Pivot Present data in a different order

Rearrange the dimensions in a data cube

Page 23: Chapter 16

16-23

Relational DBMS Support Data modeling Dimension representation GROUP BY extensions Materialized views and query rewriting Storage structures and optimization

Page 24: Chapter 16

16-24

Relational Data Modeling Dimension table: contains member values Fact table: contains measure values 1-M relationships from dimension to fact

tables Grain: most detailed measure values

stored

Page 25: Chapter 16

16-25

Star Schema Example

CustomerCustIdCustNameCustPhoneCustStreetCustCityCustStateCustZipCustNation

StoreStoreIdStoreManagerStoreStreetStoreCityStoreStateStoreZipStoreNationDivIdDivNameDivManager

SalesSalesNoSalesUnitsSalesDollarSalesCost

ItemItemIdItemNameItemUnitPriceItemBrandItemCategory

TimeDimTimeNoTimeDayTimeMonthTimeQuarterTimeYearTimeDayOfWeekTimeFiscalYear

ItemSales

CustSales

TimeSales

StoreSales

Page 26: Chapter 16

16-26

Constellation Schema

CustomerCustIdCustNameCustPhoneCustStreetCustCityCustStateCustZipCustNation

StoreStoreIdStoreManagerStoreStreetStoreCityStoreStateStoreZipStoreNationDivIdDivNameDivManager

SalesSalesNoSalesUnitsSalesDollarSalesCost

ItemItemIdItemNameItemUnitPriceItemBrandItemCategory

TimeDimTimeNoTimeDayTimeMonthTimeQuarterTimeYearTimeDayOfWeekTimeFiscalYear

ItemSales

CustSales

TimeSales

StoreSales

InventoryInvNoInvQOHInvCostInvReturns

SupplierSuppIdSuppNameSuppCitySuppStateSuppZipSuppNation

SuppInv

ItemInv

StoreInv

TimeInv

Page 27: Chapter 16

16-27

Snowflake Schema Example

CustomerCustIdCustNameCustPhoneCustStreetCustCityCustStateCustZipCustNation

StoreStoreIdStoreManagerStoreStreetStoreCityStoreStateStoreZipStoreNation

SalesSalesNoSalesUnitsSalesDollarSalesCost

ItemItemIdItemNameItemUnitPriceItemBrandItemCategory

TimeDimTimeNoTimeDayTimeMonthTimeQuarterTimeYearTimeDayOfWeekTimeFiscalYear

ItemSales

CustSales

TimeSales

StoreSales

DivisionDivIdDivNameDivManager

DivStore

Page 28: Chapter 16

16-28

Handling M-N Relationships Source data may have M-N relationships,

not 1-M relationships Adjust fact or dimension tables for a fixed

number of exceptions More complex solutions to support M-N

relationships with a variable number of connections

Page 29: Chapter 16

16-29

Time Representation

Timestamp Time dimension table for organization

specific calendar features Two fact tables for international operations Accumulating fact table for representation

of multiple events

Page 30: Chapter 16

16-30

Level of Historical Integrity

Primarily an issue for dimension updates Type I: overwrite old values Type II: version numbers for an unlimited

history Type III: new columns for a limited history

Page 31: Chapter 16

16-31

Historical Integrity Example

CustomerCustIdVersionNoCustNameCustPhoneCustStreetCustCityCustCityBegEffDateCustCityEndEffDateCustStateCustZipCustNation

CustomerCustIdCustNameCustPhoneCustStreetCustCityCurrCustCityCurrBegEffDateCustCityCurrEndEffDateCustCityPrevCustCityPrevBegEffDateCustCityPrevEndEffDateCustCityPastCustCityPastBegEffDateCustCityPastEndEffDateCustStateCustZipCustNation

Type II Representation Type III Representation

Page 32: Chapter 16

16-32

Dimension Representation Star schema and variations lack

dimension representation Explicit dimension representation

important to data cube operations and optimization

Proprietary extensions for dimension representation

Represent levels, hierarchies, and constraints

Page 33: Chapter 16

16-33

Oracle Dimension Representation

Levels: dimension components Hierarchies: may have multiple hierarchies Constraints: functional dependency

relationships

Page 34: Chapter 16

16-34

CREATE DIMENSION ExampleCREATE DIMENSION StoreDim LEVEL StoreId IS Store.StoreId LEVEL City IS Store.StoreCity LEVEL State IS Store.StoreState LEVEL Zip IS Store.StoreZip LEVEL Nation IS Store.StoreNation LEVEL DivId IS Division.DivId HIERARCHY CityRollup ( StoreId CHILD OF City CHILD OF State CHILD OF Nation )HIERARCHY ZipRollup ( StoreId CHILD OF Zip CHILD OF State CHILD OF Nation )HIERARCHY DivisionRollup ( StoreId CHILD OF DivId JOIN KEY Store.DivId REFERENCES DivId )ATTRIBUTE DivId DETERMINES Division.DivNameATTRIBUTE DivId DETERMINES Division.DivManager ;

Page 35: Chapter 16

16-35

GROUP BY Extensions ROLLUP operator CUBE operator GROUPING SETS operator Other extensions

Ranking Ratios Moving summary values

Page 36: Chapter 16

16-36

CUBE ExampleSELECT StoreZip, TimeMonth, SUM(SalesDollar) AS SumSales FROM Sales, Store, Time WHERE Sales.StoreId = Store.StoreId AND Sales.TimeNo = Time.TimeNo AND (StoreNation = 'USA' OR StoreNation = 'Canada') AND TimeYear = 2005 GROUP BY CUBE (StoreZip, TimeMonth)

Page 37: Chapter 16

16-37

ROLLUP ExampleSELECT TimeMonth, TimeYear, SUM(SalesDollar) AS SumSales FROM Sales, Store, Time WHERE Sales.StoreId = Store.StoreId AND Sales.TimeNo = Time.TimeNo AND (StoreNation = 'USA' OR StoreNation = 'Canada') AND TimeYear BETWEEN 2005 AND 2006 GROUP BY ROLLUP (TimeMonth,TimeYear);

Page 38: Chapter 16

16-38

GROUPING SETS ExampleSELECT StoreZip, TimeMonth, SUM(SalesDollar) AS SumSales FROM Sales, Store, Time WHERE Sales.StoreId = Store.StoreId AND Sales.TimeNo = Time.TimeNo AND (StoreNation = 'USA' OR StoreNation = 'Canada') AND TimeYear = 2005 GROUP BY GROUPING SETS((StoreZip, TimeMonth), StoreZip, TimeMonth, ());

Page 39: Chapter 16

16-39

Variations of the Grouping Operators Partial cube Partial rollup Composite columns CUBE and ROLLUP inside a GROUPIING

SETS operation

Page 40: Chapter 16

16-40

Materialized Views

Stored view Periodically refreshed with source data Usually contain summary data Fast query response for summary data Appropriate in query dominant

environments

Page 41: Chapter 16

16-41

Materialized View ExampleCREATE MATERIALIZED VIEW MV1BUILD IMMEDIATEREFRESH COMPLETE ON DEMANDENABLE QUERY REWRITE ASSELECT StoreState, TimeYear, SUM(SalesDollar) AS SUMDollar1 FROM Sales, Store, Time WHERE Sales.StoreId = Store.StoreId AND Sales.TimeNo = Time.TimeNo AND TimeYear > 2003 GROUP BY StoreState, TimeYear;

Page 42: Chapter 16

16-42

Query Rewriting

Substitution process Materialized view replaces references to

fact and dimension tables in a query Query optimizer must evaluate whether

the substitution will improve performance over the original query

More complex than query modification process for traditional views

Page 43: Chapter 16

16-43

Query Rewriting Process

Rewrite SQL EngineQueryFD QueryMV

Results

QueryFD: query that references fact and dimension tables

QueryMV: rewrite of QueryFD such that materialized views are substituted for fact and dimension tables whenever justified by expected performance improvements.

Page 44: Chapter 16

16-44

Query Rewriting Matching

Row conditions: query conditions at least as restrictive as MV conditions

Grouping detail: query grouping columns at least as general as MV grouping columns

Grouping dependencies: query columns must match or be derivable by functional dependencies

Aggregate functions: query aggregate functions must match or be derivable from MV aggregate functions

Page 45: Chapter 16

16-45

Query Rewriting Example-- Data warehouse querySELECT StoreState, TimeYear, SUM(SalesDollar) FROM Sales, Store, Time WHERE Sales.StoreId = Store.StoreId AND Sales.TimeNo = Time.TimeNo AND StoreNation IN ('USA','Canada') AND TimeYear = 2005 GROUP BY StoreState, TimeYear;-- Query Rewrite: replace Sales and Time tables with MV1SELECT DISTINCT MV1.StoreState, TimeYear, SumDollar1FROM MV1, StoreWHERE MV1.StoreState = Store.StoreState AND TimeYear = 2005 AND StoreNation IN ('USA','Canada');

Page 46: Chapter 16

16-46

Storage and Optimization Technologies MOLAP: direct storage and manipulation

of data cubes ROLAP: relational extensions to support

multidimensional data HOLAP: combine MOLAP and ROLAP

storage engines

Page 47: Chapter 16

16-47

ROLAP Techniques Bitmap join indexes Star join optimization Query rewriting Summary storage advisors Parallel query execution

Page 48: Chapter 16

16-48

Maintaining a Data Warehouse Data sources Workflow representation Optimizing the refresh process

Page 49: Chapter 16

16-49

Data Sources Cooperative:

Notification using triggers Requires source system changes

Logged Readily available Extraneous data in logs

Queryable Queries using timestamps Requires timestamps in source data

Snapshot Periodic dumps of source data Significant processing for difference operations

Page 50: Chapter 16

16-50

Maintenance Workflow

PreparationPhase

IntegrationPhase

UpdatePhase

Propagation

Notification

Extraction

Cleaning

Auditing

Transportation

Merging

Auditing

Page 51: Chapter 16

16-51

Data Quality Problems Multiple identifiers Multiple field names Different units Missing values Orphaned values Multipurpose fields Conflicting data Different update times

Page 52: Chapter 16

16-52

ETL Tools Extraction, Transformation, and Loading Specification based Eliminate custom coding Third party and DBMS based tools

Page 53: Chapter 16

16-53

Refresh Processing

Accounting

UnknownProcesses

ExternalData Sources

InternalData Sources

DataWarehouse

ETLTools

Valid Time Lag

Load Time Lag

Fact andDimensionChanges

PrimarilyDimensionChanges

Page 54: Chapter 16

16-54

Determining the Refresh Frequency Maximize net refresh benefit Value of data timeliness Cost of refresh Satisfy data warehouse and source

system constraints

Page 55: Chapter 16

16-55

Refresh Constraints

Source access: restrictions on time and frequency

Integration: restrictions that require concurrent reconciliation

Completeness/consistency: loading in the same refresh period

Availability: load scheduling restrictions due to storage capacity, online availability, and server usage

Page 56: Chapter 16

16-56

Summary Data warehouse requirements differ from

transaction processing. Architecture choice is important. Multidimensional data model is intuitive Relational representation and storage

techniques are significant. Maintaining a data warehouse is an

important, operational problem.