Data Warehousing And OLAP Technology

Transcription

Data Warehousing and OLAP TechnologyObjectives . 3What is Data Warehouse?. 42.1. Definitions . 42.2. Data Warehouse—Subject-Oriented. 52.3. Data Warehouse—Integrated. 52.4. Data Warehouse—Time Variant . 62.5. Data Warehouse—Non-Volatile. 62.6. Data Warehouse vs. Heterogeneous DBMS . 72.7. Data Warehouse vs. Operational DBMS . 72.8. OLTP vs. OLAP . 82.9. Why Separate Data Warehouse?. 93. Multidimensional Data Model . 103.1. Definitions . 104. Conceptual Modeling of Data Warehousing. 124.1. Star Schema . 134.2. Snowflake Schema. 144.3. Fact Constellation . 155. A Data Mining Query Language: DMQL. 165.1. Definitions and syntax . 165.2. Defining a Star Schema in DMQL . 175.3. Defining a Snowflake Schema in DMQL. 185.4. Defining a Fact Constellation in DMQL . 195.5. Measures: Three Categories. 215.6. How to compute data cube measures? . 226. A Concept Hierarchy . 247. OLAP Operations in a Multidimensional Data. 268. OLAP Operations . 299. Starnet Query Model for Multidimensional Databases . 3310.Data warehouse architecture. 3410.1. DW Design Process . 351.2.A. BellaachiaPage: 1

10.2. Three Data Warehouse models . 3710.3. OLAP Server Architectures . 3911.Data Warehouse Implementation. 4011.1. Materialization of data cube . 4011.2. Cube Operation. 4111.3. Cube Computation Methods . 4311.4. Multi-way Array Aggregation for Cube ComputationError! Bookmark not defined.11.5. Indexing OLAP Data: Bitmap Index . 4411.6. Indexing OLAP Data: Join Indices. 4511.7. Efficient Processing OLAP Queries . 4611.8. Data Warehouse Usage. 4611.9. Why online analytical mining? . 4712.An OLAM Architecture. 48A. BellaachiaPage: 2

1. Objectives What is a data warehouse? Data warehouse design issues. General architecture of a data warehouse Introduction to Online Analytical Processing (OLAP)technology. Data warehousing and data mining relationship.A. BellaachiaPage: 3

2. What is Data Warehouse?2.1. Definitions Defined in many different ways, but not rigorously. A decision support database that is maintained separatelyfrom the organization’s operational database Support information processing by providing a solid platformof consolidated, historical data for analysis. “A data warehouse is a subject-oriented, integrated, timevariant, and nonvolatile collection of data in support ofmanagement’s decision-making process.”—W. H. Inmon Operational Data: Data used in day-to-day needs of company. Informational Data: Supports other functions such asplanning and forecasting. Data mining tools often access data warehouses rather thanoperational data. Data warehousing: The process of constructing and usingdata warehouses.A. BellaachiaPage: 4

2.2. Data Warehouse—Subject-Oriented Organized around major subjects, such as customer,product, sales. Focusing on the modeling and analysis of data for decisionmakers, not on daily operations or transaction processing. Provide a simple and concise view around particularsubject issues by excluding data that are not useful in thedecision support process.2.3. Data Warehouse—Integrated Constructed by integrating multiple, heterogeneous datasourceso Relational databases, flat files, on-line transactionrecords Data cleaning and data integration techniques are applied.o Ensure consistency in naming conventions, encodingstructures, attribute measures, etc. among different datasources E.g., Hotel price: currency, tax, breakfast covered,etc.oA. BellaachiaWhen data is moved to the warehouse, it is converted.Page: 5

2.4. Data Warehouse—Time Variant The time horizon for the data warehouse is significantlylonger than that of operational systems.o Operational database: current value data.o Data warehouse data: provide information from ahistorical perspective (e.g., past 5-10 years) Every key structure in the data warehouseo Contains an element of time, explicitly or implicitlyo But the key of operational data may or may not contain“time element”.2.5. Data Warehouse—Non-Volatile A physically separate store of data transformed from theoperational environment. Operational update of data does not occur in the datawarehouse environment.o Does not require transaction processing, recovery, andconcurrency control mechanismso Requires only two operations in data accessing: Initial loading of data and access of data.A. BellaachiaPage: 6

2.6. Data Warehouse vs. Heterogeneous DBMS Traditional heterogeneous DB integration:o Build wrappers/mediators on top of heterogeneousdatabaseso Query driven approach When a query is posed to a client site, a metadictionary is used to translate the query intoqueries appropriate for individual heterogeneoussites involved, and the results are integrated into aglobal answer set Complex information filtering, compete forresources Data warehouse: update-driven, high performanceo Information from heterogeneous sources is integrated inadvance and stored in warehouses for direct query andanalysis2.7. Data Warehouse vs. Operational DBMS OLTP (on-line transaction processing)o Major task of traditional relational DBMSo Day-to-day operations: purchasing, inventory, banking,manufacturing, payroll, registration, accounting, etc. OLAP (on-line analytical processing)o Major task of data warehouse systemo Data analysis and decision making Distinct features (OLTP vs. OLAP):o User and system orientation: customer vs. marketo Data contents: current, detailed vs. historical,consolidatedo Database design: ER application vs. star subjecto View: current, local vs. evolutionary, integratedA. BellaachiaPage: 7

o Access patterns: update vs. read-only but complexqueries2.8. OLTP vs. OLAPUsersFunctionOLTPClerk, IT professionalDay to day operationsOLAPKnowledge workerDecision supportDB ent, up-to-dateDetailed, flat relationalIsolatedRepetitiveRead/write, Index/hash onprim. KeyShort, simple transactionTensHistorical, Summarized,multidimensionalIntegrated, consolidatedAd-hocLots of scansThousands100MB-GBHundreds100GB-TBTransaction throughputQuery throughput, responseUsageAccessUnit of work# recordsaccessed#usersDB sizeMetricA. BellaachiaComplex queryMillionsPage: 8

2.9. Why Separate Data Warehouse? High performance for both systemso DBMS— tuned for OLTP: access methods, indexing,concurrency control, recoveryo Warehouse—tuned for OLAP: complex OLAP queries,multidimensional view, and consolidation. Different functions and different data:o Missing data: Decision support requires historical datawhich operational DBs do not typically maintaino Data consolidation: DS requires consolidation(aggregation, summarization) of data fromheterogeneous sourceso Data quality: different sources typically use inconsistentdata representations, codes and formats which have tobe reconciled.A. BellaachiaPage: 9

3. Multidimensional Data Model3.1. Definitions A data warehouse is based on a multidimensional datamodel which views data in the form of a data cube. This is not a 3-dimensional cube: it is n-dimensionalcube. Dimensions of the cube are the equivalent of entitiesin a database, e.g., how the organization wants to keeprecords. Examples: Product Dates Locations A data cube, such as sales, allows data to be modeledand viewed in multiple dimensionso Dimension tables, such as item (item name,brand, type), or time(day, week, month, quarter,year)o Fact table contains measures (such asdollars sold) and keys to each of the relateddimension tables In data warehousing literature, an n-D base cube iscalled a base cuboid. The top most 0-D cuboid, whichholds the highest-level of summarization, is called theapex cuboid. The lattice of cuboids forms a data cube.A. BellaachiaPage: 10

Cube: A lattice of cuboidstimeTotal sum of all salesitemall0-D(apex) cuboiditemtimelocationsupplier1-D ,supplier2-D plietime,item,location3-D , item, location, supplier4-D(base) cuboidtimelocationitemtimelocationitemA. BellaachiaEach supplierPage: 11

4. Conceptual Modeling of Data Warehousing Modeling data warehouses: dimensions & measureso Star schema: A fact table in the middleconnected to a set of dimension tableso Snowflake schema: A refinement of star schemawhere some dimensional hierarchy isnormalized into a set of smaller dimensiontables, forming a shape similar to snowflakeo Fact constellations: Multiple fact tables sharedimension tables, viewed as a collection of stars,therefore called galaxy schema or factconstellationA. BellaachiaPage: 12

4.1. Star Schematimetime keydayday of the weekmonthquarteryearSales Fact Tabletime keyitem keyitemitem keyitem namebrandtypesupplier typebranch keybranchlocation keybranch keybranch namebranch typeunits solddollars soldlocationlocation keystreetcitystate or provincecountryavg salesMeasuresA. BellaachiaPage: 13

4.2. Snowflake Schemaitemtimetime keydayday of the weekmonthquarteryearSales Fact Tabletime keyitem keyitem namebrandtypesupplier typeitem keysuppliersupplier keysupplier typbranch keylocation keybranchbranch keybranch namebranch typeunits soldA. Bellaachialocation keystreetcity keydollars soldavg salesMeasureslocationcitycity keycitystate or provincecountryPage: 14

4.3. Fact ConstellationitemtimeShipping Fact Tabletime keydayday of the weekmonthquarteryearitem keySales Fact Table item nametime keyitem keybrandtypesupplier typebranchbranch keybranch namebranch typeunits solddollars soldavg salesMeasuresA. Bellaachiaitem keyShipper keyfrom locationto locationbranch keylocation keytime keydollars costlocationlocation keystreetcitystate orprovincecountryunits shippedshippershipper keyshipper namelocation keyshipper typePage: 15

5. A Data Mining Query Language: DMQL5.1. Definitions and syntax Similar to RDBMS, we need a DDL (data definitionlanguage) to define the tables in the conceptual model. Cube Definition (Fact Table) Syntax:define cube cube name [ dimension list ]: measure list Exampledefine cube sales star [time, item, branch, location]:dollars sold sum(sales in dollars),avg sales avg(sales in dollars),units sold count(*) Dimension Definition ( Dimension Table ) Syntax:define dimension dimension name as ( attribute or subdimension list ) Example:define dimension itemas (item key, item name, brand, type,supplier type)A. BellaachiaPage: 16

Special Case (Shared Dimension Tables) First time as “cube definition” Syntax:define dimension dimension name as dimension name first time in cube cube name first time Example:define dimension item as item in cube sales5.2. Defining a Star Schema in DMQLdefine 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)A. BellaachiaPage: 17

5.3. Defining a Snowflake Schema in DMQLdefine 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))A. BellaachiaPage: 18

5.4. Defining a Fact Constellation in DMQLdefine cube sales [time, item, branch, location]:dollars sold sum(sales in dollars),avg sales avg(sales in dollars),units sold count(*)define dimension timeas (time key, day, day of week, month, quarter, year)define dimension itemas (item key, item name, brand, type, supplier type)define dimension branchas (branch key, branch name, branch type)define dimension locationas (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 timeas timein cube salesdefine dimension itemas itemin cube salesA. BellaachiaPage: 19

define dimension shipperas ( shipper key,shipper name,location as location in cube sales,shipper type)define dimension from locationas locationin cube salesdefine dimension to locationas locationin cube salesA. BellaachiaPage: 20

5.5. Measures: Three Categories A data cube function is a numerical function that canbe evaluated at each point in the data cube space. Given a data point in the data cube space:Entry(v1, v2, , vn)where vi is the value corresponding to dimension di.We need to apply the aggregate measures to thedimonsion values v1, v2, , vn Distributive:o If the result derived by applying the function to naggregate values is the same as that derived byapplying the function on all the data withoutpartitioning.o Example: count(), sum(), min(), max(). Algebraic:o Use distributive aggregate functions.o If it can be computed by an algebraic functionwith M arguments (where M is a boundedinteger), each of which is obtained by applying adistributive aggregate function.A. BellaachiaPage: 21

o Example: avg(), min N(), standard deviation(). Holistic:o If there is no constant bound on the storage sizeneeded to describe a subaggregate.o E.g., median(), mode(), rank().5.6. How to compute data cube measures? How do evaluate the dollars sold and unit sold in the starschema of the previous example? Assume that the relation database schema correspondingto our example is the following:time (time key, day, day of week, month, quarter, year)item (item key, item name, brand, type, supplier(supplier key,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 unit sold, price)A. BellaachiaPage: 22

Let us then compute the two measures we have in our datacube: dollars sold and units soldselect 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 swhere s.time key t.time keyand s.item key i.item keyand s.branch key b.branch keyand s.location key l.location keygroup by s.time key, s.item key, s.branch key,s.location key Relationship between “data cube” and “group by”? The above query corresponds to the base cuboid. By changing the group by clause in our query, wemay generate other cuboids. What is query for the 0-D cuboid or apex?A. BellaachiaPage: 23

6. A Concept Hierarchy A concept hierarchy is an order relation between a set ofattributes of a concept or dimension. It can be manually (users or experts) or automaticallygenerated (statistical analysis). Multidimensional data is usually organized into dimensionand each dimension is further defined into a lower level ofabstractions defined by concept hierarchies. Example: Dimension (location)allallregionNorth AmericaEurope.countrycityofficeA. Bellaachia.GermanyFrankfurtSpain.L. ChanCanadaVancouver.MexicoTorontoM. WindPage: 24

The order can be either partial or total:Location dimension: Street city state countryTime dimension: Day {month quarter ; week} otal order hierarchyPartial order hierarchy Set-grouping hierarchy: A. BellaachiaIt is a concept hierarchy among groups of values.Example: {1.10} inexpensivePage: 25

7. OLAP Operations in a Multidimensional Data Sales volume as a function of product, time, and region. Dimensions hierarchical concepts: Product, Location,TimeIndustry Æ Category Æ ProductRegion Æ Country Æ City Æ OfficeYear Æ Quarter Æ Month Æ DayWeek Sales volume as a function of product, month, andregion.regionProductMonthA. BellaachiaPage: 26

A Sample data cube:ProductTVPCVCR1QtrTotal aMexicosum Cuboids of the sample cube:all0-D(apex) y1-D cuboidsdate, country2-D cuboids3-D(base) cuboidproduct, date, countryA. BellaachiaPage: 27

Querying a data cubeA. BellaachiaPage: 28

8. OLAP Operations Objectives:o OLAP is a powerful analysis tool: Forecasting Statistical computations, aggregations, etc. Roll up (drill-up): summarize datao It is performed by climbing up hierarchy of adimension or by dimension reduction (reducethe cube by one or more dimensions).o The roll up operation in the example is basedlocation (roll up on location) is equivalent togrouping the data by country.New ameraroll upA. BellaachiaDate ofsaleVideoCamera CDNO22830VA231822Page: 29

Drill down (roll down):o It is the reverse of roll-upo It is performed by stepping down a concepthierarchy for a dimension or introducing newdimensions. Slice and Dice:o Project and Select operationso Check the example. Pivot (rotate):o Re-orient the cube for an alternativepresentation of the datao Transform 3D view to series of 2D planes. Other operationso Drill across: involving (across) more than onefact table.o Drill through: through the bottom level of thecube to its back-end relational tables (usingSQL)A. BellaachiaPage: 30

A. BellaachiaPage: 31

A. BellaachiaPage: 32

9. Starnet Query Model for Multidimensional Databases Each radial line represents a dimension Each abstraction level in a hierarchy concept is called afootprint Apply OLAP operations.Customer CKProductPRODUCT LINETimeANNUALY QTRLDAILCOUNTRYPRODUCT ITEMCITYREGIONA. BellaachiaSALESDISTRICTLocationEach circle is called a footprintPRODUCT GROUPDIVISIONPromotionOrganizationPage: 33

10. Data warehouse architecture The design of a successful DW requires the understandingand the analysis of business requirements: Competitive advantage Enhance business productivity Cost reduction Four views regarding the design of a data warehouse:o Top-down view: allows selection of the relevant informationnecessary for the data warehouse. It covers thecurrent and future business needs.o Data source view: This view exposes the information being captured,stored, and managed by operational systems. Usually modeled by traditional data modelingtechniques, e.g., ER model.o Data warehouse view: This view consists of fact tables and dimensiontables.o Business query view: This view sees the perspectives of data in thewarehouse from the view of end-userA. BellaachiaPage: 34

10.1. DW Design Process Top-down, bottom-up approaches or a combination ofboth Top-down: Starts with overall design and planning(mature) Bottom-up: Starts with experiments and prototypes (rapid)o From software engineering point of viewo Waterfall: structured and systematic analysis at eachstep before proceeding to the nexto Spiral: rapid generation of increasingly functionalsystems, short turn around time, quick turn around Typical data warehouse design processo Choose a business process to model, e.g., orders,invoices, etc.o Choose the grain (atomic level of data) of the businessprocesso Choose the dimensions that will apply to each fact tablerecordo Choose the measure that will populate each fact tablerecordA. BellaachiaPage: 35

Multi-Tiered ouseOLAPServerServeAnalysisQueryReportsDataData MartsData SourcesA. BellaachiaData StorageOLAPEngineFront-End ToolsPage: 36

10.2. Three Data Warehouse models Enterprise warehouseo Collect all of the information about subjectsspanning the entire organization. Data Marto a subset of corporate-wide data that is of value toa specific groups of users. Its scope is confined tospecific, selected groups, such as marketing datamart Independent vs. dependent (directly fromwarehouse) data mart. Virtual warehouseo A set of views over operational databaseso Only some of the possible summary views maybe materializedA. BellaachiaPage: 37

A Recommended ApproachMulti-Tier DataWarehouseDistributed DataMartsDataMartEnterprise DataWarehouseDataMartModel refinementModel refinementDefine a high-level corporate data model Build the data warehouse incrementally, data marts Æ datawarehouse:o Start with a data modelo Build each data mart in the organization in parallelo Integrate the data martsA. BellaachiaPage: 38

10.3. OLAP Server Architectures Relational OLAP (ROLAP)o Use relational or extended-relational DBMS tostore and manage warehouse data and OLAPmiddle ware to support missing pieceso Include optimization of DBMS backend,implementation of aggregation navigation logic,and additional tools and serviceso greater scalability Multidimensional OLAP (MOLAP)o Array-based multidimensional storage engine(sparse matrix techniques)o fast indexing to pre-computed summarized data Hybrid OLAP (HOLAP)o User flexibility, e.g., low level: relational, highlevel: arrayo Specialized SQL serverso specialized support for SQL queries overstar/snowflake schemas How data is actually stored in ROLAP and MOLAB?o Two methods: Base cuboid data is stored in a base facttable Aggregate data: Data can be stored in the base facttable (Summary Fact table), or Data can be stored in a separatesummary fact tables to store eachlevel of abstraction.A. BellaachiaPage: 39

11. Data Warehouse Implementation Objectives: Monitoring: Sending data from sources Integrating: Loading, cleansing,. Processing: Efficient cube computation, andquery processing in general, indexing, . Cube Computationo One approach extends SQL using compute cubeoperatoro A cube operator is the n-dimensional generalization ofthe group-by SQL clause.o OLAP needs to compute the cuboid corresponding eachinput query.o Pre-computation: for fast response time, it seems agood idea to pre-compute data for all cuboids or at leasta subset of cuboids since the number of cuboids is: 2nIf no hierarchy ifhierarchyand number of cuboids n( Li 1) Li is number of levels i 1 associated with d dim ension i11.1. Materialization of data cube Store in warehouse results useful for common queries Pre-compute some cuboidsA. BellaachiaPage: 40

This is equivalent to the define new warehouse relationsusing SQL expressions Materialize every (cuboid) (full materialization), none (nomaterialization), or some (partial materialization) Selection of which cuboids to materialize Based on size, sharing, access frequency, etc. Define new warehouse relations using SQLexpressions11.2. Cube Operation Cube definition and computation in DMQLdefine cube sales[item, city, year]: sum(sales in dollars)compute cube sales Transform it into a SQL-like language (with a new operatorcube by, introduced by Gray et al.’96)SELECT item, city, year, SUM (amount)FROM SALESCUBE BY item, city, year Need compute the following Group-Bys(date, product, customer),(date,product),(date, customer), (product,customer),(date), (product), (customer)()A. BellaachiaPage: 41

()(city)(city, item)(item)(city, year)(year)(item, year)(city, item, year)A. BellaachiaPage: 42

11.3. Cube Computation Methods ROLAP-based cubingo Sorting, hashing, and grouping operationsare applied to the dimension attributes inorder to reorder and cluster related tupleso Grouping is performed on somesubaggregates as a “partial grouping step”o Aggregates may be computed frompreviously computed aggregates, rather thanfrom the base fact table MOLAP Approacho Uses Array-based algorithmo The base cuboid is stored asmultidimensional array.o Read in a number of cells to compute partialcuboidsA. BellaachiaPage: 43

11.4. Indexing OLAP Data: Bitmap Index Approach:o Index on a particular columno Each value in the column has a bit vector: bit-op isfasto The length of the bit vector: # of records in the basetableo The i-th bit is set if the i-th row of the base table hasthe value for the indexed columno Not suitable for high cardinality domains Example:Base iaDealerC4AmericaRetailC5EuropeDealerIndex on ndex on Type:RecID12345A. BellaachiaRetail10010Dealer01101Page: 44

11.5. Indexing OLAP Data: Join Indices Join index:JI(R-id, S-id)where R (R-id, ) S (S-id, ) Traditional indices map the values to a list of record ids It materializes relational join in JI file and speeds uprelational join — a rather costly operation In data warehouses, join index relates the values of thedimensions of a star schema to rows in the fact table.o E.g. fact table: Sales and two dimensions city andproduct A join index on city maintains for each distinctcity a list of R-IDs of the tuples recording theSales in the city Join indices can span multiple dimensionsA. BellaachiaPage: 45

11.6. Efficient Processing OLAP Queries Determine which operations should be performed onthe available cuboids:o transform drill, roll, etc. into corresponding SQLand/or OLAP operations, e.g, dice selection projection Determine to which materialized cuboid(s) therelevant operations should be applied. Exploring indexing structures and compressed vs.dense array structures in MOLAP11.7. Data Warehouse Usage Three kinds of data warehouse applicationso Information processing supports querying, basic statistical analysis, andreporting using crosstabs, tables, charts andgraphso Analytical processing multidimensional analysis of data warehouse data supports basic OLAP operations, slice-dice,drilling, pivotingo Data mining knowledge discovery from hidden patterns supports associations, constructing analyticalmodels, performing classification and prediction,and presenting the mining results usingvisualization tools. Differences among the three tasksA. BellaachiaPage: 46

11.8. Why online analytical mining? High quality of data in data warehouseso DW contains integrated, consistent, cleaned data Available information processing structure surroundingdata warehouseso ODBC, OLEDB, Web accessing, service facilities,reporting and OLAP tools OLAP-based exploratory data analysiso mining with drilling, dicing, pivoting, etc. On-line selection of data mining functionso Integration and swapping of multiple mining functions,algorithms, and tasks. Architecture of OLAMA. BellaachiaPage: 47

12. An OLAM ArchitectureLayer4User InterfaceMining resultMining queryUser GUI APIOLAMEngineLayer3OLAP/OLAMOLAPEngineData Cube APILayer2MDDBMDDBMeta DataFiltering&IntegrationDatabase APIData cleaningDatabasesA. BellaachiaData integrationFilteringDataWarehouseLayer1Data RepositoryPage: 48

2.9. Why Separate Data Warehouse? High performance for both systems o DBMS— tuned for OLTP: access methods, indexing, concurrency control, recovery o Warehouse—tuned for OLAP: complex OL