8 Copyright © 2009, Oracle. All rights reserved. Modeling Multidimensional OLAP Dimensions and Cubes
Copyright © 2009, Oracle. All rights reserved Objectives After completing this lesson, you should be able to: Use Warehouse Builder MOLAP dimension modeling capabilities –Value-based and skip-level hierarchies –Default hierarchy for multidimensional query tools Use Warehouse Builder MOLAP cube modeling capabilities –Conformed dimensions –Defining multiple cubes using the same dimensions at different levels –Custom measures –Sparsity –Preaggregation
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved What Is OLAP? OLAP stands for online analytical processing. Online: You have access to live data (rather than static data). Analytical: You can analyze your data for reporting. You can create reports that are: –Multidimensional –Calculation-rich –Supported by time-based analysis –Ideal for applications with unpredictable, ad hoc query requirements
Copyright © 2009, Oracle. All rights reserved Examining an OLAP Question An OLAP question is a multidimensional query, as in the following: “What was the percentage change in revenue for a grouping of our top 20% products one year ago over a rolling three-month time period compared to the current period this year, for each region of the world?” This is a simple business question, but the actual query can be quite complex.
Copyright © 2009, Oracle. All rights reserved
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved Sales dimensioned by product, customer, and time SALES cube ProductCustomer Time Multidimensional Data Types Data is stored in multidimensional cubes in the analytic workspace.
Copyright © 2009, Oracle. All rights reserved Implementing a Dimensional Data Model with Multidimensional Data Types You can use multidimensional data types when: Ad hoc usage patterns are unpredictable Query performance requirements are high The analytic requirements of the business include extended analytic, forecasting, and planning functionality Calculation requirements are more extensive A data model that supports what-if analysis is required
Copyright © 2009, Oracle. All rights reserved Dimensional Model The multidimensional logical model has the following elements: Measures Dimensions Hierarchies Levels Attributes
Copyright © 2009, Oracle. All rights reserved Measures Represent factual data (sometimes called “facts”; OWB groups measures in “cubes”) Are organized by one or more dimensions Populate the cells of a logical cube Can be numeric data, text, date, Boolean, and so on
Copyright © 2009, Oracle. All rights reserved Measure Types Measures are of two types: Stored measures: –Can store the result in a variable Calculated measures: –Can evaluate calculated data in a formula at query time StoredCalculated
Copyright © 2009, Oracle. All rights reserved Example of Measures in a Report Stored measure Calculated measure Crosstab report containing four measures:
Copyright © 2009, Oracle. All rights reserved Dimensions Dimensions: Form the “edges” of the measure Provide pointers to the actual cells inside the multidimensional measures Q1 Q2 Q3 Q4 Time Product Africa Europe Asia Americas SALES cube Regions Laptop Camcorder Camera Monitor
Copyright © 2009, Oracle. All rights reserved Example of Dimensions in a Report Product TimeCustomerChannel
Copyright © 2009, Oracle. All rights reserved Quiz Which of the following elements does the multidimensional logical model have? a.Measures b.Dimensions c.Columns d.Hierarchies e.Levels f.Attributes g.Tables
Copyright © 2009, Oracle. All rights reserved Hierarchies A hierarchy is a parent-child relationship among the members of a dimension. Hierarchies enable logical groupings of dimension members for the purposes of: –Navigation of data –Aggregation of measures –Allocation of data in a planning and budgeting application Dimensions usually have hierarchies.
Copyright © 2009, Oracle. All rights reserved Hierarchy: Example Hierarchies enable you to navigate from the lowest level to the highest level, or from the highest to the lowest. You can aggregate data from the lowest level to the highest level. Software Hardware PCs Laptops Monitors XMY Z L1L2L3 Y1Y2Y3 Total Product …
Copyright © 2009, Oracle. All rights reserved Levels All Products Category Subcategory Product Software Hardware PCs Laptops Monitors XMY Z L1L2L3 Y1Y2Y3 Total Product …
Copyright © 2009, Oracle. All rights reserved Types of Hierarchy Director VPAdmin Director VP President Day Month Quarter Year Level-based hierarchy Value-based hierarchy Director
Copyright © 2009, Oracle. All rights reserved Attributes Attributes provide descriptive information about the dimension members. Attributes are also useful when you are selecting dimension members for analysis: –Select the products whose color (attribute) is “Blue.” –Select the customers who have two children. –Select the promotions that are of type “Multipack.” –Select all time periods whose description contains “January.”
Copyright © 2009, Oracle. All rights reserved Attributes: Examples Total Karl Bruce Mary John Mary Manager Yellow sheets Red sheets White pillows Red shirt Green pants Red pants Blue shirt Product Yellow Red White Red Green Red Blue Color Sheets Pillows Bedding Women’s Men’s Kids’ Clothing SubcategoryCategory LevelsAttributes
Copyright © 2009, Oracle. All rights reserved Dimensional Model Summarized The multidimensional logical model has the following elements: Measures Dimensions –Hierarchies –Levels –Attributes Time Product Customer Item Brand Manufacturer MonthQuarterYear Sales Product Share Sales Year to Date Profit Average Selling Price
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved Analytic Workspace Is a container that holds multidimensional data and objects Is designed for efficient processing of multidimensional calculations Supports advanced calculations and rapid query performance Can be temporary or persistent Is a special table (LOB) in a tablespace ( AW$tablename )
Copyright © 2009, Oracle. All rights reserved Analytic Workspace Analytic workspaces are built using: –Oracle Warehouse Builder –Analytic Workspace Manager (AWM 11g) –AW XML API (for 10g form AWs) –OLAP Java API (for 11g form AWs) –OLAP DML An analytic workspace can be accessed by: –Business intelligence tools from Oracle –Business intelligence tools from partners –SQL –OLAP APIs
Copyright © 2009, Oracle. All rights reserved Analytic Workspace: Creation and Maintenance Privileges To create and maintain an analytic workspace, you must have the following: OLAP_USER role (automatically granted to an OWB run- time user when that user is created with OWB Repository Assistant) SELECT privileges on the source schema tables Sufficient quota on the tablespace in which the workspace is created SELECT, INSERT, and UPDATE privileges for the analytic workspace
Copyright © 2009, Oracle. All rights reserved OLAP DML Is a very powerful, multidimensional-aware language that enables developers to truly exploit the power of the OLAP option Supports the definition of multidimensional calculations, including customized calculations unique to your organization Contains an inventory of several hundred analytic functions Enables application developers to extend the analytical capabilities of the AW Is accessible from the OWB Design Center user interface
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved Tools to Build an Analytic Workspace Cube building Extract, transform, load (ETL) Oracle Warehouse Builder Analytic Workspace Manager (AWM) OWB: Advanced ETL and AW deployment AWM: Builds an analytic workspace from clean data Clean data Analytic workspace Source systems
Copyright © 2009, Oracle. All rights reserved Quiz An analytic workspace: Is a container that holds multidimensional data and objects Is designed for efficient processing of multidimensional calculations Supports advanced calculations and rapid query performance Is a special table (LOB) in a tablespace a.True b.False
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved Dimensional Modeling Customers should need to think only about designing the dimension and cube, less about how the Oracle database stores data and performs extract, transform, load (ETL). Customers want to focus on product hierarchy; Oracle will figure out how and where to store data and perform ETL.
Copyright © 2009, Oracle. All rights reserved Enabling OLAP Solutions MOLAP? Schema Logical design Analytic Workspace ETL ROLAP? AW created using XML API to the OLAP option Warehouse Builder 11g is capable of directly loading any data into the analytic workspace, allowing, for the first time, the wealth of transformation power on OLAP data loads. Create a logical design describing your OLAP cubes in dimensions, hierarchies, measures, calculated measures, and other components. Warehouse Builder uses the XML API to the OLAP option to directly create the AW and its objects and the metadata required in the database catalogs. After you have created your cubes and dimensions, use the Warehouse Builder ETL modelers to create the load programs, independent of storage decisions.
Copyright © 2009, Oracle. All rights reserved Storage Management If you enter the name of an analytic workspace (AW) that does not exist, it will be created automatically when you deploy this object. If you do not specify an AW name, OWB will create an AW using the module name, as soon as you generate the dimensional object. If table space name is left blank, AW goes into the tablespace of the user. Two choices for keys
Copyright © 2009, Oracle. All rights reserved Dimensional Modeling Using OWB Advanced modeling features enables full spectrum of dimensional capabilities, including: Value-based hierarchies Skip-level hierarchies And more
Copyright © 2009, Oracle. All rights reserved Hierarchy Support: Value-Based Day Month Quarter Year Level-based hierarchy Value-based hierarchy Adam (VP) Smith (Admin) James (Admin) Bruce (Director) Jones (VP) KING (President) Lex (Director) Den (Director)
Copyright © 2009, Oracle. All rights reserved Create a Value-Based Hierarchy Value-based hierarchies are only for MOLAP dimensions.
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved Calculated Measures CUSTOMER PRODUCTPRODUCT TIME Quantity Sold measure X= CUSTOMER PRODUCTPRODUCT TIME PRODUCTPRODUCT Unit Price measure Revenue calculated measure QuantityPriceRevenue X=
Copyright © 2009, Oracle. All rights reserved OWB Calculated Measures
Copyright © 2009, Oracle. All rights reserved Generating Calculated Measures Time Series Share/Index Rank
Copyright © 2009, Oracle. All rights reserved Sparsity If you mark a dimension as sparse, Warehouse Builder creates a composite dimension to manage sparse data.
Copyright © 2009, Oracle. All rights reserved Compress Cube
Copyright © 2009, Oracle. All rights reserved Partition Cube
Copyright © 2009, Oracle. All rights reserved Cost-Based Aggregation Cube wizard defaults to 20% of the lowest level of data to be precomputed. Pre-aggregation slows the build, but speeds up queries.
Copyright © 2009, Oracle. All rights reserved Level-Based Aggregation Level-based aggregation is available for cubes deploying to an Oracle release prior to 11g.
Copyright © 2009, Oracle. All rights reserved Lesson Agenda OLAP concepts: Introduction Multidimensional data model –Measures –Dimensions –Hierarchies –Levels Analytic workspace Oracle Database 11g OLAP Warehouse Builder MOLAP dimension modeling Warehouse Builder MOLAP cube modeling Deploying MOLAP mappings
Copyright © 2009, Oracle. All rights reserved Differences Between OLAP and Relational Loading Differences between OLAP and relational deployment and loading: Not much! (from the user perspective) 1.Deploy the data objects (dimensions and cubes). 2.Deploy the mappings. 3.Run the mappings to load data into an OLAP cube.
Copyright © 2009, Oracle. All rights reserved No Relational Tables to Bind Dimension Synchronize to repository object, data stored in relational table Implementing table Dimension Bind ROLAP MOLAP Deploy to DB, data stored in AW Cube-organized materialized view - Relational fact table - Summaries stored in AW Schema table AW
Copyright © 2009, Oracle. All rights reserved Partially Predefined OLAP Module Target module: SALES_AW Target user: SALES_AW All dimensions are predefined. All dimension-loading and cube-loading mappings are predefined. Create the SALES cube. Create the target user SALES_AW (test connecting with it in the SALES_AW_LOCATION ). Register SALES_AW_LOCATION with the DEFAULT_CONTROL_CENTER. Deploy dimensions, cube, and mappings. Execute mappings. Sales CustomersChannels Promotions Times Products DB source module: XSALES Channels, Promotions, Products, Addresses, Categories, Cities, Countries, Customers, Regions, Promo- subcategories, Promo- categories, Orders, Order_items Mappings Items in italic are predefined SALES_AW module (mostly predefined)
Copyright © 2009, Oracle. All rights reserved Examine the Predefined Dimensions and Mappings You define the SALES cube. Notice… no implementation tables!
Copyright © 2009, Oracle. All rights reserved Define the Sales Cube 1. Define quickly and easily using a wizard. 2. Make further specifications using an editor.
Copyright © 2009, Oracle. All rights reserved Create an OLAP Target User
Copyright © 2009, Oracle. All rights reserved Specify Whether to Create a Location
Copyright © 2009, Oracle. All rights reserved Location Created
Copyright © 2009, Oracle. All rights reserved Associate the Module with the Target Location Module configuration Control center Location User
Copyright © 2009, Oracle. All rights reserved Register the Target Location
Copyright © 2009, Oracle. All rights reserved Deploying OLAP Objects with Control Center Manager Deploying OLAP objects to AW is much like deploying relational objects.
Copyright © 2009, Oracle. All rights reserved Executing OLAP Mappings “Set based fail over to row based” is being chosen as the default operating mode.
Copyright © 2009, Oracle. All rights reserved View Cube Data in the Data Viewer CHANNELS dimension AMOUNT, COST, QUANTITY measures PRODUCTS dimension
Copyright © 2009, Oracle. All rights reserved Quiz In cubes, preaggregating slows the build, but speeds up the queries. a.True b.False
Copyright © 2009, Oracle. All rights reserved Summary In this lesson, you should have learned how to: Use Warehouse Builder MOLAP dimension modeling capabilities –Value-based and skip-level hierarchies –Default hierarchy for multidimensional query tools Use Warehouse Builder MOLAP cube modeling capabilities –Conformed dimensions –Defining multiple cubes using the same dimensions at different levels –Custom measures –Sparsity –Preaggregation
Copyright © 2009, Oracle. All rights reserved Practice 8-1: Overview In the hands-on practice, you will perform the following: Work on a partially defined MOLAP project, including creation of a MOLAP cube