Create Presentation
Download Presentation

Download Presentation

Data Warehousing : and OLAP — MIS 542 — — Chapter 4 —

Download Presentation
## Data Warehousing : and OLAP — MIS 542 — — Chapter 4 —

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Data Warehousing: and OLAP—MIS 542— — Chapter 4 —**2014/2015 Fall**Chapter 3: Data Warehousing and OLAP Technology for Data**Mining • What is a data warehouse? • A multi-dimensional data model • Data warehouse architecture • Data warehouse implementation • Further development of data cube technology • From data warehousing to data mining**What is Data Warehouse?**• Defined in many different ways, but not rigorously. • A decision support database that is maintained separately from the organization’s operational database • Support information processing by providing a solid platform of consolidated, historical data for analysis. • “A data warehouse is asubject-oriented, integrated, time-variant, and nonvolatilecollection of data in support of management’s decision-making process.”—W. H. Inmon • Data warehousing: • The process of constructing and using data warehouses**Data Warehouse—Subject-Oriented**• 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.**Data Warehouse—Integrated**• 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.**Data Warehouse—Time 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”.**Data Warehouse—Non-Volatile**• 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 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**Data 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**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**Chapter 2: Data Warehousing and OLAP Technology for Data**Mining • What is a data warehouse? • A multi-dimensional data model • Data warehouse architecture • Data warehouse implementation • Further development of data cube technology • From data warehousing to data mining**From Tables and Spreadsheets to Data Cubes**• A data warehouse is based on a multidimensional data model which views data in the form of a data cube • A data cube, such as sales, allows data to be modeled and viewed in multiple dimensions • Dimensions • A sale data warehouse with respect to dimension • time, item, branch, location • Dimension tables, such as • item (item_name, brand, type), or • time(day, week, month, quarter, year) • Facts: numerical measures • dollars_sold: sales amount in dollars • units_sold: number of units sold • Fact table contains measures (such as dollars_sold) and keys to each of the related dimension tables**A 2-D data cube: A table or spreadsheet**for sales from AllElectronics AllElectronics sales data for items sold per quarter in the city of Istanbul Time dimension organized in quarters item dimension by types of items sold The fact or measure is dollar_sold**A three dimensional cube**Dimensions: time, item, location for the cities**A Data Cube Representation of the same data**• Sales volume as a function of product, month, and region Dimensions: Product, Location, Time Hierarchical summarization paths izmir locations ankara istabbul items phon comp Quarters Q1**A 4-D Cube as a series of 3-D cubes**Dimensions: item,time,location,supplier From Supplier A From Supplier B From Supplier C locations items Quarters**n-Dimensional Cube**• Any n-D data as a series of (n-1)-D “cubes” • In data warehousing literature, • A data cube is referred to as a cuboid • The lattice of cuboids forms a data cube. • The cuboid holding the lowest level of summarization is called a base cuboid. • the 4-D cuboid is the base cuboid for the given four dimensions • The top most 0-D cuboid, which holds the highest-level of summarization, is called the apex cuboid. • Here this is the total sales, or dollars_sold summarized over all four dimensions • typically denoted by all**Cube: A Lattice of Cuboids**all 0-D(apex) cuboid time item location supplier 1-D cuboids time,item time,location item,location location,supplier 2-D cuboids time,supplier item,supplier time,location,supplier time,item,location 3-D cuboids item,location,supplier time,item,supplier 4-D(base) cuboid time, item, location, supplier**Conceptual Modeling of Data Warehouses**• Modeling data warehouses: dimensions & measures • 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 constellations: Multiple fact tables share dimension tables, viewed as a collection of stars, therefore called galaxy schema or fact constellation**item**time item_key item_name brand type supplier_type time_key day day_of_the_week month quarter year location branch location_key street city province_or_street country branch_key branch_name branch_type Example of Star Schema Sales Fact Table time_key item_key branch_key location_key units_sold dollars_sold avg_sales Measures**supplier**item time item_key item_name brand type supplier_key supplier_key supplier_type time_key day day_of_the_week month quarter year city location branch city_key city province_or_street country location_key street city_key branch_key branch_name branch_type Example of Snowflake Schema Sales Fact Table time_key item_key branch_key location_key units_sold dollars_sold avg_sales Measures**A unnormalizedCity Table**City province and Country is repeated For every steet in İstanbul A NormalizedCityTable Unnecessary repitations of province end country are eliminated Memory gain but complex queries**item**time item_key item_name brand type supplier_type time_key day day_of_the_week month quarter year location location_key street city province_or_street country shipper branch shipper_key shipper_name location_key shipper_type branch_key branch_name branch_type Example of Fact Constellation Shipping Fact Table time_key Sales Fact Table item_key time_key shipper_key item_key from_location branch_key to_location location_key dollars_cost units_sold units_shipped dollars_sold avg_sales Measures**Measures: Three Categories**• A multidimensional point in the data cube space • dimension-value pairs: • (time=“Q1”,location=“Istanbul”,item=“computer”) • A data cube measure is a numerical function that can be evaluated at each point in the data cube space • computed for a given point by aggregating the data corresponding to the respective dimension-value pairs defining the given point**Measures: Three Categories**• distributive: • Suppose the data D ispartitioned into n sets Di i =1,..n • the computation of the function f on each partition derives one aggregate value • Ai =f(Di) i = 1,..,n, f(D)=f(A1,A2,..,An) • if the result derived by applying the function to n aggregate values is the same as that derived by applying the function on all the data without partitioning. • The function can be computed in a distributed manner • E.g., count(), sum(), min(), max().**Example: Sum()**• Data set: D:{1,3,6,8,9} • Sum(D) = 27 • Partition the set into D1 end D2 as • D1:{1,3,6), D2:{8.9} • Sum(D1) = 10, Sum(D2) = 17 • Sum(sum(D1),sum(D2)) = sum(10,17) =27 =sum(D)**Measures: Three Categories**• algebraic:if it can be computed by an algebraic function with M arguments (where M is a bounded integer), each of which is obtained by applying a distributive aggregate function. • E.g.,avg(), min_N(), standard_deviation(). • E.g.,avg() = sum()/count() • both sum() and count() are distributive agg. Functions • Show that • min_N(), standard_deviation().**Measures: Three Categories**• holistic: if there is no constant bound on the storage size needed to describe a subaggregate. • There is no an algebric function with M arguments(M being bounded) that characterizes the computation • E.g., median(), mode(), rank().**Example**• The relational database scheme for AE: • time(time_key,day,day_of_week,month,quarter,year) • item(item_key,item_name,brand,type,supplier_type) • branch(branch_key,branch_name,branch_type) • location(location_key,street,city,province_or_state,country) • sales(time_key,item_key,branch_key,location_key,number_of_units_sold,price)**Example cont.**• Select s.time_key,s.item_key,s.branch_key,s.location_key, • sum(s.number_of_units_sold*s.price), • sum(s.number_of_units_sold) • from time t, item i,branch b,location l,sales s, • where s.time_key=t.time_key and • s.item_key=i.item_key and • s.branch_key=b.branch_key and • s.location_key=l.location_key • group by s.time_key, s.item_key, s.branch_key,s.location_key**Example Cont.**• The cube created is the base cuboid of the sales_star datacube • it contains all of the dimensions • granularity of each is at the join key level • by changing the group by clauses • E.g., • group by t.month: sum up the measures of each group by month • removing group by s.branch_key: generate a higher-level cuboid • recoving all group bys: total sum of dollars sold and total count of units_sold • zero-dimensional cuboid is apex cuboid**Time by month**• Select t.year,t.month,s.item_key,s.branch_key,s.location_key,sum(s.number_of_units_sold*s.price),sum(s.number_of_units_sold) • from time t, item i,branch b,location l,sales s, • where s.time_key=t.time_key and • s.item_key=i.item_key and • s.branch_key=b.branch_key and • s.location_key=l.location_key • group by t.year, t.month, s.item_key, s.branch_key,s.location_key**A three dimensional cuboid**• Select s.time_key,s.item_key, s.location_key, • sum(s.number_of_units_sold*s.price), • sum(s.number_of_units_sold) • from time t, item i,branch b,location l,sales s, • where s.time_key=t.time_key and • s.item_key=i.item_key and • s.branch_key=b.branch_key and • s.location_key=l.location_key • group by s.time_key, s.item_key,s.location_key**Concept hierarchies**• Defines a sequence of mappings from a set of low-level concepts to high-level more general concepts • E.g., dimension location is described by • number,street,city,province_or_state,zipcode and country • are related by a total order, forming a concept hierarchy • street<city<province_or_state<country • The attributes of a dimension may be organized in a partial order, forming a lattice • day,week,month,quarter, year • day<[month<quarter,week]<year**A Concept Hierarchy: Dimension (location)**all all Europe ... North_America region Germany ... Spain Canada ... Mexico country Vancouver ... city Frankfurt ... Toronto L. Chan ... M. Wind office**Partially ordered co**• The attributes of a dimension may be organized in a partial order, forming a lattice • day,week,month,quarter, year • day<[month<quarter,week]<year • predefined in the data mining system • time • fiscal year starting on April 1 • academic year starting on September 1**Multidimensional Data**• Sales volume as a function of product, month, and region Dimensions: Product, Location, Time Hierarchical summarization paths Region Industry Region Year Category Country Quarter Product City Month Week Office Day Product A partially ordered hierarchy Month**Cuboids Corresponding to the Cube**all 0-D(apex) cuboid location item time 1-D cuboids item,time item,location time, location 2-D cuboids 3-D(base) cuboid item, time, location**Set grouping hierarchy**• Set-grouping hierarchy: • discretizing or grouping values for a given dimension or attribute • Ex: price • There may be more than one concept hierarchy for a given attribute or dimension based on different user viewpoints • price by defining ranges for • inexpensive, moderately_priced,expensive**How defined?**• provided by manually by • system users • domain experts • knowledge engineers or • automatically generated based on statistical analysis of the data distribution**Typical OLAP Operations**• In the multidimensional model data are organized into multiple dimensions • each dimension contains multiple levels of abstraction defined by concept hierarchies • This organization provides users with the flexibility to view data from different perspectives**Example**• Refer to figure 2.10 in Han’s book • data cube for AllElls sales • dimensions: location,time,item • location -- city • time -- quarters • item -- item types • measure displayed is dollars-sold**Cuboids Corresponding to the Cube**all 0-D(apex) cuboid location item time 1-D cuboids item,time item,location time, location 2-D cuboids 3-D(base) cuboid item, time, location**Roll-up (drill-up)**• Climbing up a concept hierarchy for a dimension or • by dimension reduction • Ex:roll-up operation aggregates data by ascending the location hierarchy • from the level of city • to the level of country • rather than grouping the data by city,the cubes • groups the data by country**By a drill up opperation examine sales**By country rather than city level roll up**when performed by dimension reduction**• one or more dimensions are removed from the cube • Ex a sales cube with location and time • roll-up may remove the time dimension • aggregation of total sales by location • rather than by location and by time Two dimensional cuboid One dim. cuboid**Drill-down (roll-down)**• reverse of roll-up • navigates from less detailed data to more detailed data • from higher level summary to lower level summary or detailed data, or • stepping down a concept hierarchy for a dimension • introducing new dimensions • Ex: drill-down for time • day<month<quarter<year • form the level of quarter • to the more detailed level of month • Adding a new dimension to the data