Optimizing Your Data Warehouse Design for Superior Performance



Similar documents
Designing a Dimensional Model

Basics of Dimensional Modeling

Week 3 lecture slides

Mastering Data Warehouse Aggregates. Solutions for Star Schema Performance

When to consider OLAP?

Dimodelo Solutions Data Warehousing and Business Intelligence Concepts

DATA WAREHOUSING - OLAP

Monitoring Genebanks using Datamarts based in an Open Source Tool

BUILDING BLOCKS OF DATAWAREHOUSE. G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT

Database Design Patterns. Winter Lecture 24

Data Warehousing. Read chapter 13 of Riguzzi et al Sistemi Informativi. Slides derived from those by Hector Garcia-Molina

Multi-dimensional index structures Part I: motivation

Sterling Business Intelligence

Data warehouse Architectures and processes

OLAP & DATA MINING CS561-SPRING 2012 WPI, MOHAMED ELTABAKH

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 29-1

Data Warehouse Snowflake Design and Performance Considerations in Business Analytics

Optimizing Performance. Training Division New Delhi

Sterling Business Intelligence

OLAP Theory-English version

New Approach of Computing Data Cubes in Data Warehousing

Data Warehousing Concepts

Cognos 8 Best Practices

Using distributed technologies to analyze Big Data

Multidimensional Modeling - Stocks

Business Intelligence, Data warehousing Concept and artifacts

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

How To Improve Performance In A Database

SQL Server 2008 Core Skills. Gary Young 2011

Delivering Business Intelligence With Microsoft SQL Server 2005 or 2008 HDT922 Five Days

Anwendersoftware Anwendungssoftwares a. Data-Warehouse-, Data-Mining- and OLAP-Technologies. Online Analytic Processing

Physical DB design and tuning: outline

OLAP Systems and Multidimensional Expressions I

Lost in Space? Methodology for a Guided Drill-Through Analysis Out of the Wormhole

Best Practices for Multi-Dimensional Design using Cognos 8 Framework Manager

University of Gaziantep, Department of Business Administration

COURSE OUTLINE. Track 1 Advanced Data Modeling, Analysis and Design

Data Warehousing. Outline. From OLTP to the Data Warehouse. Overview of data warehousing Dimensional Modeling Online Analytical Processing

news from Tom Bacon about Monday's lecture

Database Applications. Advanced Querying. Transaction Processing. Transaction Processing. Data Warehouse. Decision Support. Transaction processing

Data Warehouse design

OLAP and OLTP. AMIT KUMAR BINDAL Associate Professor M M U MULLANA

Business Intelligence for SUPRA. WHITE PAPER Cincom In-depth Analysis and Review

DATA WAREHOUSING AND OLAP TECHNOLOGY

Week 13: Data Warehousing. Warehousing

Data Warehousing, OLAP, and Data Mining

CHAPTER 5: BUSINESS ANALYTICS

Module 1: Introduction to Data Warehousing and OLAP

IBM Cognos 8 Business Intelligence Analysis Discover the factors driving business performance

Oracle BI Suite Enterprise Edition

CS54100: Database Systems

W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

Jet Data Manager 2012 User Guide

East Asia Network Sdn Bhd

DATA WAREHOUSE BUSINESS INTELLIGENCE FOR MICROSOFT DYNAMICS NAV

1. OLAP is an acronym for a. Online Analytical Processing b. Online Analysis Process c. Online Arithmetic Processing d. Object Linking and Processing

Data Warehouse design

DIMENSIONAL MODELLING

Published by: PIONEER RESEARCH & DEVELOPMENT GROUP ( 28

Outline. Data Warehousing. What is a Warehouse? What is a Warehouse?

OLAP and Data Mining. Data Warehousing and End-User Access Tools. Introducing OLAP. Introducing OLAP

Creating Hybrid Relational-Multidimensional Data Models using OBIEE and Essbase by Mark Rittman and Venkatakrishnan J

ETL Process in Data Warehouse. G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT

MS SQL Performance (Tuning) Best Practices:

SQL Server Administrator Introduction - 3 Days Objectives

CS2032 Data warehousing and Data Mining Unit II Page 1

Learning Objectives. Definition of OLAP Data cubes OLAP operations MDX OLAP servers

Beyond Plateaux: Optimize SSAS via Best Practices

BW-EML SAP Standard Application Benchmark

Optimizing the Performance of the Oracle BI Applications using Oracle Datawarehousing Features and Oracle DAC

Oracle OLAP. Describing Data Validation Plug-in for Analytic Workspace Manager. Product Support

14. Data Warehousing & Data Mining

IBM WebSphere DataStage Online training from Yes-M Systems

Avoiding Common Analysis Services Mistakes. Craig Utley

Kimball Dimensional Modeling Techniques

Student Guide. SAP BusinessObjects XI 3.0 Universe Design

Introduction to Data Warehousing. Ms Swapnil Shrivastava

UNIVERSE DESIGN BEST PRACTICES. Roxanne Pittman, InfoSol May 8, 2014

In-Memory Data Management for Enterprise Applications

LearnFromGuru Polish your knowledge

SAP BusinessObjects Accounts Receivable Rapid Mart XI 3.2, version for SAP solutions - User Guide

TRANSFORMING YOUR BUSINESS

High-Volume Data Warehousing in Centerprise. Product Datasheet

2074 : Designing and Implementing OLAP Solutions Using Microsoft SQL Server 2000

Data Warehouse and Business Intelligence Testing: Challenges, Best Practices & the Solution

CHAPTER 4: BUSINESS ANALYTICS

Turning your Warehouse Data into Business Intelligence: Reporting Trends and Visibility Michael Armanious; Vice President Sales and Marketing Datex,

Tiber Solutions. Understanding the Current & Future Landscape of BI and Data Storage. Jim Hadley

DATA CUBES E Jayant Haritsa Computer Science and Automation Indian Institute of Science. JAN 2014 Slide 1 DATA CUBES

Republic Polytechnic School of Information and Communications Technology C355 Business Intelligence. Module Curriculum

Review. Data Warehousing. Today. Star schema. Star join indexes. Dimension hierarchies

SQL SERVER TRAINING CURRICULUM

Oracle Exam 1z0-591 Oracle Business Intelligence Foundation Suite 11g Essentials Version: 6.6 [ Total Questions: 120 ]

Data Warehousing and OLAP

2009 Oracle Corporation 1

Unlock your data for fast insights: dimensionless modeling with in-memory column store. By Vadim Orlov

Transcription:

Optimizing Your Data Warehouse Design for Superior Performance Lester Knutsen, President and Principal Database Consultant Advanced DataTools Corporation Session 2100A

The Problem The database is too complex for users to understand and build queries! The numbers from queries do not add up! The data is wrong and users don t trust it! When two users build separate reports, the numbers don t match! Users cannot build queries that compare numbers in different data marts inventory to sales! Performance is so slow! 2100A Optimizing Your Data Warehouse Design for Superior Performance 2

Tips for Optimizing Your Data Warehouse Design Build a dimensional model star schema. Put all facts in one table; avoid double-counting. Standardize the grain of measurement; avoid facts with different grains of measurement. Build standard calculated fields in the database; avoid having users do standard calculations. Set defaults in the database schema: no nulls in the database. Include a row for Not Found in every table: no outer joins. Check the data during the loads; it s too late if an error is found in a report. Build a hierarchy of aggregates of facts: summary tables or OLAP cubes. Build a consistent hierarchy of dimensions: rollups. Build an enterprise architecture for dimensions. 2100A Optimizing Your Data Warehouse Design for Superior Performance 3

NEW Tips for Optimizing Your Data Warehouse Design Know when NOT to uses Indexes Know when to allow Sequential Scans and how to avoid buffer turnover problems Know how to Partition your data onto different disk drives Know when to use Dirty Reads and how to read data avoiding locks and your database server log files Use ½ of your disk drives, leave the rest empty your database throughput will be faster Know how to use Composite Indexes and when to use them, and how to get Index-Only Reads Know about Update Statistics and why it is important 2100A Optimizing Your Data Warehouse Design for Superior Performance 4

Data Warehouse Architecture Data Source Data Warehouse Server Staging Area and Load Database Web Users Data Warehouse Database Web and Hyperion Performance Suite 2100A Optimizing Your Data Warehouse Design for Superior Performance 5

Data Warehouse Design Considerations What is the key question you want to ask of your data? Organize and summarize your data to answer this question quickly. Allow for unexpected ad hoc queries of the data to provide new insight into your business. Focus on solving the business problem: What information do we need to make better business decisions? 2100A Optimizing Your Data Warehouse Design for Superior Performance 6

Data Warehouse Design How do you organize the data? Keep it simple. Design Goals: Fast data access Ease of use Star Schema: Fact tables - The detail data Dimension tables - Look-up information Summary tables - Presummarized results 2100A Optimizing Your Data Warehouse Design for Superior Performance 7

Example Data Model Organization Financial Detail Fact Table Budget Object Class Program Codes Labor Detail Fact Table Time 2100A Optimizing Your Data Warehouse Design for Superior Performance 8

Example Summary Tables Financial Summary Division Cost Target Summary Agency Cost Target Summary State Cost Target Summary The goal of the summary tables is to answer 90% of all queries. Summary tables save system resources for handling complex ad hoc queries. 2100A Optimizing Your Data Warehouse Design for Superior Performance 9

Goals of a Data Warehouse The data warehouse provides access to corporate or organizational data. Data is consistent. Data can be sliced and diced. Tools to query, analyze, and present the data are available. The data warehouse is a place to publish data. The quality of data drives business change (driver of business reengineering). 2100A Optimizing Your Data Warehouse Design for Superior Performance 10

Goals of the Transactional Model Fast data entry No redundancy in data by separating data into multiple tables Normalization of data relationships to ensure data integrity Short, fast queries for example, current customer status/balance Continually changing data 2100A Optimizing Your Data Warehouse Design for Superior Performance 11

Problems with Querying OLTP Databases Relational model is too complex for users. Database is not designed for large queries while data is changing. (Deadlocks will occur.) Queries slow down transactions. Hence the need for a separate specialized database for query and analysis The data warehouse 2100A Optimizing Your Data Warehouse Design for Superior Performance 12

Dimensional Model A design methodology determines the relevant dimensions and facts for each business process of an organization. Facts are measurable typically numbers. Dimensions are reference or descriptive points for examining facts. 2100A Optimizing Your Data Warehouse Design for Superior Performance 13

Facts: Numbers Additive (facts) Measures in a fact table that can be added across all dimensions Semiadditive (facts) Measures that can be added across some, but not all, dimensions Continuously valued facts A measure that is different every time it is measured Fact table The central table in a star-joined schema, characterized by a composite key made up of foreign keys to each of the dimension tables 2100A Optimizing Your Data Warehouse Design for Superior Performance 14

Dimension: Text Descriptions Dimension An independent entry in a model or organization that serves as a point for slicing the facts of an organization Slowly changing dimensions Tendency of a dimension to change over time (for example, customer name); three methods to handle this Conforming dimensions Dimensions that have exactly the same set of primary keys and same number of records in different data marts or data warehouses 2100A Optimizing Your Data Warehouse Design for Superior Performance 15

Dimension Degenerate dimension A dimension key that has no attributes and hence no actual dimension table; for example, order number in the stores database. (Degenerate dimensions go in the fact table.) Snowflake dimension A normalized dimension where a single table is decomposed into a tree structure (Do not Snowflake, as it will be harder for users to query!) 2100A Optimizing Your Data Warehouse Design for Superior Performance 16

Grain A grain is the meaning of a single record in the fact table. The determination of the grain of the fact tables is one of the key steps in the design of a star schema: Snapshot grain Transactional grain Hierarchy consistency Time consistency What is the scope of the fact that you are measuring? 2100A Optimizing Your Data Warehouse Design for Superior Performance 17

Aggregates Aggregated facts The results of an SQL statement that uses SUM, COUNT, MIN, MAX or AVG Aggregates Precalculated and prestored summaries that are stored in the warehouse to improve query performance and make it easier for users to query (summary tables or OLAP cubes) 2100A Optimizing Your Data Warehouse Design for Superior Performance 18

Key Steps in Design 1. Identify the business process to model: What is the key question you want to ask of the data? 2. Identify the grain: What level of detail is required to answer the question? 3. Identify the dimensions: What are the report column headings to slice the data? 4. Identify the facts: What are the numbers? 2100A Optimizing Your Data Warehouse Design for Superior Performance 19

Avoid Double-Counting: Put All Facts in One Table SQL joins tables with one (table A) to many (table B) relationships by creating a result set of all the rows. In this case, any numbers in table A will be double-counted. 2100A Optimizing Your Data Warehouse Design for Superior Performance 20

Double-Counting Example: One Order Has Many Items 2100A Optimizing Your Data Warehouse Design for Superior Performance 21

Double-Counting Example: Ship Charge is Double-Counted 2100A Optimizing Your Data Warehouse Design for Superior Performance 22

Double-Counting: Solutions Custom SQL, Unions, etc: Works but is very complicated for users. Add a column to the fact table for Ship Charge and divide the charge by the number of items. Add a column to the fact table for Ship Charge and add a row with zero-item cost. Add a row to the item table for Ship Charge as an item. 2100A Optimizing Your Data Warehouse Design for Superior Performance 23

Solution 1: Ship Charge Divided by Items ADD A COLUMN FOR SHIP CHARGE AND DIVIDE BY THE NUMBER OF ITEMS create table items_fact_1 ( item_num smallint, order_num integer, stock_num smallint not null, manu_code char(3) not null, quantity smallint, total_price money(8,2), ship_charge money(6,2), -- New Field primary key (item_num,order_num) ); insert into items_fact_1 Select item_num, order_num, stock_num, manu_code, quantity, total_price, ( select ( ship_charge / ( select count(*) from items b where b.order_num = items.order_num ) ) from orders where orders.order_num = items.order_num ) from items; 2100A Optimizing Your Data Warehouse Design for Superior Performance 24

Solution 1: Ship Charge Divided by Items 2100A Optimizing Your Data Warehouse Design for Superior Performance 25

Solution 2: Add a Row for Ship Charge ADD A COLUMN FOR SHIP CHARGE AND ADD A ROW WITH ZERO ITEM COST insert into items_fact_2 ( item_num, order_num, stock_num, manu_code, quantity, total_price, ship_charge ) Select item_num, order_num, stock_num, manu_code, quantity, total_price, 0 -- Must default to 0 from items; ------------------------------------- insert into items_fact_2 ( item_num, order_num, stock_num, manu_code, quantity, total_price, ship_charge ) Select 0, order_num, 0, "NONE", 0, 0, Ship_Charge from orders; 2100A Optimizing Your Data Warehouse Design for Superior Performance 26

Solution 2: Add a Row for Ship Charge 2100A Optimizing Your Data Warehouse Design for Superior Performance 27

Solution 3: Add a Row to the Item Table for Ship Charge as an Item ADD A ROW TO THE ITEM TABLE FOR SHIP CHARGE AS AN ITEM -- Insert the items insert into items_fact_3 ( item_num, order_num, stock_num, manu_code, quantity, total_price) Select item_num, order_num, stock_num, manu_code, quantity, total_price from items; -- Insert the Ship Change insert into items_fact_3 ( item_num, order_num, stock_num, manu_code, quantity, total_price) Select 0, order_num, 0, "SHP", 1, Ship_Charge from orders; 2100A Optimizing Your Data Warehouse Design for Superior Performance 28

Solution 3: Add a Row to the Item Table for Ship Charge as an Item Ship Charge 2100A Optimizing Your Data Warehouse Design for Superior Performance 29

Avoid Facts with Different Grains of Measurement Facts (numbers) should have the same grain in order to add up, or users may get the wrong answer: Snapshot grain Transactional grain Hierarchy consistency Time consistency 2100A Optimizing Your Data Warehouse Design for Superior Performance 30

Facts with Different Grains of Measurement Transform all facts to a common grain. Pick the fact with the highest grain level and roll up all facts to that level. This loses some of the detail of the lowest level. Expand, enhance, transform some facts to a lower level of detail so that all facts have the same lowest level of detail. This may create some misleading (bad) data. Carefully fix and match facts in summary tables to make sure everything adds up. 2100A Optimizing Your Data Warehouse Design for Superior Performance 31

Example: Facts with Different Grains of Measurement Agency tracks expenses at the Executing Org level (lowest branch level). Agency plans budget at the Budget Org level (office level). Hierarchy is as follows: Executing Org ->Budget Org -> State Org ->Agency. How do they compare budget to expenses? 2100A Optimizing Your Data Warehouse Design for Superior Performance 32

Avoid Having Users Do Standard Calculations Two users may not agree on the same definition of a term. They may get the calculations wrong. Having users doing standard calculations runs the risk of making the data warehouse seem unfriendly and complex. If the answers are wrong or inconsistent, the data warehouse will be viewed as wrong. 2100A Optimizing Your Data Warehouse Design for Superior Performance 33

Build Standard Calculations in a Summary Table 2100A Optimizing Your Data Warehouse Design for Superior Performance 34

No Nulls: Set Defaults in Database Schema NULL plus a number equals a NULL. Totals on a column with one NULL will equal NULL. Joins with columns containing NULL are more complex: from tablea, tableb where ( tablea.col1 is NULL and tableb.col1 is NULL ) and tablea.col2 = tableb.col2 Solution: Set the default for all facts to be zero in the schema. Set a default Not Found for all dimensions where there might be NULLs. 2100A Optimizing Your Data Warehouse Design for Superior Performance 35

No Outer Joins: Include a Row for Not Found Outer joins increase the chance for user error; Result may be wrong answers. Solution: Add a record to every dimension table to handle data not found: Not Found None NULL When a fact record is missing dimension data, point it to the row Not Found. 2100A Optimizing Your Data Warehouse Design for Superior Performance 36

Check the Data During the Loads It s too late if an error is found in a Hyperion report. Audit the load process. Have a report from the production system that the load process balances to in the staging area before it loads the data warehouse. 2100A Optimizing Your Data Warehouse Design for Superior Performance 37

Build a Hierarchy of Aggregates of Facts: Summary Tables Summary tables are your best performance tool. Build summary tables that will aggregate the facts by 10-100 times. Example: Financial Detail Summary by Month Summary by Quarter Summary by Year 2100A Optimizing Your Data Warehouse Design for Superior Performance 38

Hierarchy of Aggregates of Facts Summary Table 3 10,000 Records Summary Table 2 100,000 Summary Table 1 1,000,000 Base Fact Table 100,000,000 Records 2100A Optimizing Your Data Warehouse Design for Superior Performance 39

Plan for drill-up Plan for drill-down Example: Program_Code Subactivity Activity Fund Appropriation Build a Consistent Hierarchy of Dimensions 2100A Optimizing Your Data Warehouse Design for Superior Performance 40

NEW Tips for Optimizing Your Data Warehouse Design Know when NOT to uses Indexes Know when to allow Sequential Scans and how to avoid buffer turnover problems Know how to Partition your data onto different disk drives Know when to use Dirty Reads and how to read data avoiding locks and your database server log files Use ½ of your disk drives, leave the rest empty your database throughput will be faster Know how to use Composite Indexes and when to use them, and how to get Index-Only Reads Know about Update Statistics and why it is important 2100A Optimizing Your Data Warehouse Design for Superior Performance 41

Know when NOT to uses Indexes Using an Index requires reading an index header, several index leaf nodes, and then finally the row This can be 3-6 read operations per row, depending on how many levels in the Index If you need to read more than 25% of a table, the index reads may add more overhead than doing a scan of the table Use Optimizer Directives to avoid indexes 2100A Optimizing Your Data Warehouse Design for Superior Performance 42

Know when to allow Sequential Scans and how to avoid buffer turnover Every database server has some system of Buffers for data when it has been read from disk, so the next user does not read the same data from disk Problem is when you are reading large amounts of data from disk, you may get Buffer trashing Calculate How may times per hour do your Buffers turnover? Look into doing Light Scans disk reads that do not go into the Buffers 2100A Optimizing Your Data Warehouse Design for Superior Performance 43

Know how to Partition your data onto different disk drives Disk drives can only read one spot on disk at a time Partition your data by some field that is used in the queries Examples: Fiscal Year and Month State Office Improves multi-user performance Improves availability of data Mirror data Most systems will read 50% from primary and 50% from mirror, thus increase read performance 2100A Optimizing Your Data Warehouse Design for Superior Performance 44

Know when to use Dirty Reads and how to read data avoiding locks and your database server log files Data Warehouse systems should be designed for fast reads Avoid logging create a save point as part of the nightly loads Avoid locks if the data is static you do not need to lock the row Use Dirty Reads 2100A Optimizing Your Data Warehouse Design for Superior Performance 45

Use ½ of your disk drives, leave the rest empty your database throughput will be faster As data is added to a disk, the disk throughput will decrease Disk Performance 1000 900 800 700 600 500 400 300 200 100 0 Performance KB/sec. 1 3 5 7 9 11 13 15 17 Number of 2GB Chunks Accessed 2100A Optimizing Your Data Warehouse Design for Superior Performance 46

Know how to use Composite Indexes and when to use them, and how to get Index- Only Reads Composite Indexes made up of 2 or more fields The order of the fields in a composite index is important Examples: First_name, Last_name, Company Company, Last_name, First_name Sometimes putting the fact in an index will allow Index-Only Reads Example: Company_code, Company_name, AR_balance 2100A Optimizing Your Data Warehouse Design for Superior Performance 47

Know about Update Statistics and why it is important Database Servers maintain statistics so the Optimizer knows what to do: Which table to read first in a join Which filter to apply first in a where clause The better information the Optimizer has, the better job it will do on your queries 2100A Optimizing Your Data Warehouse Design for Superior Performance 48

Tips for Optimizing Your Data Warehouse Design for Superior Performance Build a dimensional model: star schema. Put all facts in one table; avoid double-counting. Standardize the grain of measurement; avoid facts with different grains of measurement. Build standard calculated fields in the database; avoid having users do standard calculations. Set defaults in database schema: no nulls in the database. Include a row for Not Found in every table: no outer joins. Check the data during the loads; it s too late if an error is found in a report. Build a hierarchy of aggregates of facts: summary tables or OLAP cubes Build a consistent hierarchy of dimensions: rollups Build an enterprise architecture for dimensions. 2100A Optimizing Your Data Warehouse Design for Superior Performance 49

Optimizing Your Data Warehouse Design for Superior Performance Lester Knutsen, President and Principal Database Consultant Advanced DataTools Corporation Slide Updates at: www.advancedatatools.com lester@advancedatatools.com 703-256-0267 x102 Session #2100A Please Complete Your Session Evaluation