Data warehousing, data analysis and OLAP Sunita Sarawagi

Slides:



Advertisements
Similar presentations
Data Warehousing.
Advertisements

Chapter 18: Data Analysis and Mining Kat Powell. Chapter 18: Data Analysis and Mining ➔ Decision Support Systems ➔ Data Analysis and OLAP ➔ Data Warehousing.
5.1Database System Concepts - 6 th Edition Chapter 5: Advanced SQL Advanced Aggregation Features OLAP.
Data Warehouses These slides are a modified version of the slides of the book “Database System Concepts” (Chapter 18), 5th Ed., McGraw-Hill, by Silberschatz,
Data Warehousing CPS216 Notes 13 Shivnath Babu. 2 Warehousing l Growing industry: $8 billion way back in 1998 l Range from desktop to huge: u Walmart:
Introduction to Data Warehousing CPS Notes 6.
Advanced Querying OLAP Data Warehousing. Database Applications Transaction processing –Online setting –Supports day-to-day operation of business Decision.
ICS 421 Spring 2010 Data Warehousing 2 Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 3/30/20101Lipyeow.
The Role of Data Warehousing and OLAP Technologies CS 536 – Data Mining These slides are adapted from J. Han and M. Kamber’s book slides (
1 CIS *717.2 Data Warehouse Design Week 2 Dimensional Modeling Primer Data Warehouse Models OLAP Operations Instructor Carmela R. Balassiano Feb 5, Spring.
Chapter 18: Data Analysis and Mining Chapter 18: Data Analysis and Mining Decision Support Systems Data Analysis and OLAP Data Warehousing Data.
Data Warehousing Xintao Wu. Evolution of Database Technology (See Fig. 1.1) 1960s: Data collection, database creation, IMS and network DBMS 1970s: Relational.
Data Warehousing.
1 1 Data Warehousing Decision-Support Systems  Data Analysis  OLAP  Extended aggregation features in SQL –Windowing and ranking  Implementation Techniques.
Chapter 18: Data Analysis and Mining
Dr. M. Sulaiman Khan Dept. of Computer Science University of Liverpool 2010 COMP207: Data Mining Data Warehousing COMP207: Data Mining.
©Silberschatz, Korth and Sudarshan22.1Database System Concepts 4 th Edition 1 SQL:1999 Advanced Querying Decision-Support Systems Data Warehousing Data.
©Silberschatz, Korth and Sudarshan22.1Database System Concepts 4 th Edition 1 Extended Aggregation SQL-92 aggregation quite limited  Many useful aggregates.
Copyright: Silberschatz, Korth and Sudarshan 1 OLAP Functions Order-Dependent Aggregates and Windows in SQL: SQL: same as SQL:1999.
1 Lecture 10: More OLAP - Dimensional modeling
Lab3 CPIT 440 Data Mining and Warehouse.
CSE6011 Warehouse Models & Operators  Data Models  relations  stars & snowflakes  cubes  Operators  slice & dice  roll-up, drill down  pivoting.
Ch3 Data Warehouse part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2009.
1 Data Warehousing and OLAP. 2 Data Warehousing & OLAP Defined in many different ways, but not rigorously.  A decision support database that is maintained.
Chapter 4 Tutorial.
Tanvi Madgavkar CSE 7330 FALL Ralph Kimball states that : A data warehouse is a copy of transaction data specifically structured for query and analysis.
CS346: Advanced Databases
1 Data Warehouses C hapter 2. 2 Chapter 2 Outline Chapter 2 Outline – Introduction –Data Warehouses –Data Warehouse in Organisation – OLTP vs. OLAP –Why.
Data warehousing and mining Session VII (Part 1) 15: :10 Sunita Sarawagi School of IT, IIT Bombay.
Dr. Bernard Chen Ph.D. University of Central Arkansas
8/20/ Data Warehousing and OLAP. 2 Data Warehousing & OLAP Defined in many different ways, but not rigorously. Defined in many different ways, but.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Decision Support Chapter 23.
Data Warehousing and Decision Support courtesy of Jiawei Han, Larry Kerschberg, and etc. for some slides. Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY.
An overview of Data Warehousing and OLAP Technology
Data warehousing and mining. 2 Introduction Organizations getting larger and amassing ever increasing amounts of data Historic data encodes useful information.
©Silberschatz, Korth and Sudarshan18.1Database System Concepts - 5 th Edition, Aug 26, 2005 Buzzword List OLTP – OnLine Transaction Processing (normalized,
Computing & Information Sciences Kansas State University Monday, 26 Nov 2007CIS 560: Database System Concepts Lecture 37 of 42 Monday, 26 November 2007.
Data Warehousing Xintao Wu. Can You Easily Answer These Questions? What are Personnel Services costs across all departments for all funding sources? What.
OLAP & DSS SUPPORT IN DATA WAREHOUSE By - Pooja Sinha Kaushalya Bakde.
©Silberschatz, Korth and Sudarshan18.1Database System Concepts - 5 th Edition, Aug 26, 2005 Extended Aggregation in SQL:1999 The cube operation computes.
Computing & Information Sciences Kansas State University Wednesday, 12 Nov 2008CIS 560: Database System Concepts Lecture 31 of 42 Wednesday, 12 November.
October 28, Data Warehouse Architecture Data Sources Operational DBs other sources Analysis Query Reports Data mining Front-End Tools OLAP Engine.
Dr. N. MamoulisAdvanced Database Technologies1 Topic 6: Data Warehousing & OLAP Defined in many different ways, but not rigorously. A decision support.
Computing & Information Sciences Kansas State University Wednesday, 29 Nov 2006CIS 560: Database System Concepts Lecture 39 of 42 Wednesday, 29 November.
1 On-Line Analytic Processing Warehousing Data Cubes.
Data Mining Data Warehouses.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module B: Advanced SQL.
Computing & Information Sciences Kansas State University Thursday, 03 May 2007CIS 560: Database System Concepts Lecture 42 of 42 Thursday, 03 May 2007.
Managing Data for DSS II. Managing Data for DS Data Warehouse Common characteristics : –Database designed to meet analytical tasks comprising of data.
January 21, 2016Data Mining: Concepts and Techniques 1 Chapter 3: Data Warehousing and OLAP Technology: An Overview What is a data warehouse? A multi-dimensional.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Data Warehousing and Decision Support.
©Silberschatz, Korth and Sudarshan5.1Database System Concepts - 6 th Edition Recursive Queries.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Data Warehousing and Decision Support Chapter 25.
Datawarehousing and OLAP C.Eng 714 Spring
Introduction to OLAP and Data Warehouse Assoc. Professor Bela Stantic September 2014 Database Systems.
Data Warehousing and OLAP Outline u Models & operations u Implementing a warehouse u Future directions.
Data Analysis Decision Support Systems Data Analysis and OLAP Data Warehousing.
Information Management course
A multi-dimensional data model
Chapter 5: Advanced SQL Database System concepts,6th Ed.
Chapter 5: Advanced SQL Database System concepts,6th Ed.
OLAP Concepts and Techniques
Data Warehousing and OLAP Technology for Data Mining
Data Analysis.
Overview of Data Warehousing and OLAP
Data Warehousing and Decision Support Chapter 25
Data Mining: Concepts and Techniques
Data Warehousing Decision-Support Systems
OLAP Functions Order-Dependent Aggregates and Windows in SQL: SQL: same as SQL:1999.
Presentation transcript:

Data warehousing, data analysis and OLAP Sunita Sarawagi sunita@iitb Data warehousing, data analysis and OLAP Sunita Sarawagi sunita@iitb.ac.in

Decision Support Systems Decision-support systems are used to make decisions, often based on data collected by on-line transaction-processing systems. Examples of decisions: What items to stock? What insurance premium to change? To whom to send advertisements? Where to open a new college campus? Examples of data used for making decisions Retail sales transaction details Customer profiles (income, age, gender, etc.) Census/tracking data

Decision support tools OLAP Data Mining Direct Query Reporting tools Intelligent Miner Essbase Crystal reports Merge Clean Summarize Relational DBMS+ e.g. Redbrick Data warehouse GIS data Detailed transactional data Census data Bombay branch Delhi branch Calcutta branch Oracle IMS SAS Operational data

Data Warehousing Data sources often store only current data, not historical data Corporate decision making requires a unified view of all organizational data, including historical data A data warehouse is a repository (archive) of information gathered from multiple sources, stored under a unified schema, at a single site Greatly simplifies querying, permits study of historical trends Shifts decision support query load away from transaction processing systems

Data Warehousing

Design Issues When and how to gather data What schema to use Source driven architecture: data sources transmit new information to warehouse, either continuously or periodically (e.g. at night) Destination driven architecture: warehouse periodically requests new information from data sources Keeping warehouse exactly synchronized with data sources (e.g. using two-phase commit) is too expensive Usually OK to have slightly out-of-date data at warehouse Data/updates are periodically downloaded form online transaction processing (OLTP) systems. What schema to use Schema integration

More Warehouse Design Issues Data cleansing E.g. correct mistakes in addresses (misspellings, zip code errors) Merge address lists from different sources and purge duplicates How to propagate updates Warehouse schema may be a (materialized) view of schema from data sources What data to summarize Raw data may be too large to store on-line Aggregate values (totals/subtotals) often suffice Queries on raw data can often be transformed by query optimizer to use aggregate values

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

Example of Star Schema item branch time Sales Fact Table time_key day day_of_the_week month quarter year time item_key item_name brand type supplier_type item Sales Fact Table time_key item_key branch_key branch_key branch_name branch_type branch location_key street city province_or_street country location location_key units_sold dollars_sold avg_sales Measures

Example of Snowflake Schema time_key day day_of_the_week month quarter year time item_key item_name brand type supplier_key item supplier_key supplier_type supplier Sales Fact Table time_key item_key branch_key location_key street city_key location branch_key branch_name branch_type branch location_key units_sold city_key city province_or_street country dollars_sold avg_sales Measures

Example of Fact Constellation time_key day day_of_the_week month quarter year time item_key item_name brand type supplier_type item Shipping Fact Table Sales Fact Table time_key item_key time_key shipper_key item_key from_location branch_key branch_key branch_name branch_type branch location_key to_location location_key street city province_or_street country location dollars_cost units_sold units_shipped dollars_sold avg_sales shipper_key shipper_name location_key shipper_type shipper Measures

Data warehouse construction Heterogeneous schema integration merge from various sources, fuzzy matches remove inconsistencies Data cleaning: missing data, outliers, clean fields e.g. names/addresses Data loading: efficient parallel loads Products: Prism warehouse manager, Platinum info refiner, info pump, QDB, Vality CHECK ON THE PRODUCTS INTERESTING ALGORITHMS

Warehouse maintenance Data refresh when to refresh, what form to send updates? Materialized view maintenance with batch updates. Query evaluation using materialized views Monitoring and reporting tools HP intelligent warehouse advisor

OLAP Fast, interactive answers to large aggregate queries. Multidimensional model: dimensions with hierarchies Dim 1: Bank location: branch-->city-->state Dim 2: Customer: sub profession --> profession Dim 3: Time: month --> quarter --> year Measures: loan amount, #transactions, balance

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 Month

A Sample Data Cube All, All, All Date Product Country Total annual sales of TV in U.S.A. Date Product Country All, All, All sum TV VCR PC 1Qtr 2Qtr 3Qtr 4Qtr U.S.A Canada Mexico

Typical OLAP Operations Roll up (drill-up): summarize data by climbing up hierarchy or by dimension reduction Drill down (roll down): reverse of roll-up from higher level summary to lower level summary or detailed data, or introducing new dimensions Slice and dice: project and select Pivot (rotate): reorient the cube, visualization, 3D to series of 2D planes. Other operations drill across: involving (across) more than one fact table drill through: through the bottom level of the cube to its back-end relational tables (using SQL)

OLAP Navigational operators: Pivot, drill-down, roll-up, select. Hypothesis driven search: E.g. factors affecting defaulters view defaulting rate on age aggregated over other dimensions for particular age segment detail along profession Need interactive response to aggregate queries..

OLAP Server Architectures Relational OLAP (ROLAP) Use relational or extended-relational DBMS to store and manage warehouse data and OLAP middle ware to support missing pieces Include optimization of DBMS backend, implementation of aggregation navigation logic, and additional tools and services greater scalability Multidimensional OLAP (MOLAP) Array-based multidimensional storage engine (sparse matrix techniques) fast indexing to pre-computed summarized data Hybrid OLAP (HOLAP) User flexibility, e.g., low level: relational, high-level: array Specialized SQL servers specialized support for SQL queries over star/snowflake schemas

OLAP Implementation (Cont.) Early OLAP systems precomputed all possible aggregates in order to provide online response Space and time requirements for doing so can be very high 2n combinations of group by It suffices to precompute some aggregates, and compute others on demand from one of the precomputed aggregates Can compute aggregate on (item-name, color) from an aggregate on (item-name, color, size) For all but a few “non-decomposable” aggregates such as median is cheaper than computing it from scratch Several optimizations available for computing multiple aggregates Can compute aggregate on (item-name, color) from an aggregate on (item-name, color, size) Can compute aggregates on (item-name, color, size), (item-name, color) and (item-name) using a single sorting of the base data Copyright: Silberschatz, Korth and Sudarshan

Extended Aggregation in SQL:1999 The cube operation computes union of group by’s on every subset of the specified attributes E.g. consider the query select item-name, color, size, sum(number) from sales group by cube(item-name, color, size) This computes the union of eight different groupings of the sales relation: { (item-name, color, size), (item-name, color), (item-name, size), (color, size), (item-name), (color), (size), ( ) } where ( ) denotes an empty group by list. For each grouping, the result contains the null value for attributes not present in the grouping. Copyright: Silberschatz, Korth and Sudarshan

Extended Aggregation (Cont.) Relational representation of cross-tab that we saw earlier, but with null in place of all, can be computed by select item-name, color, sum(number) from sales group by cube(item-name, color) Copyright: Silberschatz, Korth and Sudarshan

Extended Aggregation (Cont.) The rollup construct generates union on every prefix of specified list of attributes E.g. select item-name, color, size, sum(number) from sales group by rollup(item-name, color, size) Generates union of four groupings: { (item-name, color, size), (item-name, color), (item-name), ( ) } Rollup can be used to generate aggregates at multiple levels of a hierarchy. E.g., suppose table itemcategory(item-name, category) gives the category of each item. Then select category, item-name, sum(number) from sales, itemcategory where sales.item-name = itemcategory.item-name group by rollup(category, item-name) would give a hierarchical summary by item-name and by category. Copyright: Silberschatz, Korth and Sudarshan

Extended Aggregation (Cont.) Multiple rollups and cubes can be used in a single group by clause Each generates set of group by lists, cross product of sets gives overall set of group by lists E.g., select item-name, color, size, sum(number) from sales group by rollup(item-name), rollup(color, size) generates the groupings {item-name, ()} X {(color, size), (color), ()} = { (item-name, color, size), (item-name, color), (item-name), (color, size), (color), ( ) } Copyright: Silberschatz, Korth and Sudarshan

Copyright: Silberschatz, Korth and Sudarshan Ranking Ranking is done in conjunction with an order by specification. Given a relation student-marks(student-id, marks) find the rank of each student. select student-id, rank( ) over (order by marks desc) as s-rank from student-marks An extra order by clause is needed to get them in sorted order select student-id, rank ( ) over (order by marks desc) as s-rank from student-marks order by s-rank Ranking may leave gaps: e.g. if 2 students have the same top mark, both have rank 1, and the next rank is 3 dense_rank does not leave gaps, so next dense rank would be 2 Copyright: Silberschatz, Korth and Sudarshan

Copyright: Silberschatz, Korth and Sudarshan Ranking (Cont.) Ranking can be done within partition of the data. “Find the rank of students within each section.” select student-id, section, rank ( ) over (partition by section order by marks desc) as sec-rank from student-marks, student-section where student-marks.student-id = student-section.student-id order by section, sec-rank Multiple rank clauses can occur in a single select clause Ranking is done after applying group by clause/aggregation Copyright: Silberschatz, Korth and Sudarshan

Copyright: Silberschatz, Korth and Sudarshan Ranking (Cont.) Other ranking functions: percent_rank (within partition, if partitioning is done) cume_dist (cumulative distribution) fraction of tuples with preceding values row_number (non-deterministic in presence of duplicates) SQL:1999 permits the user to specify nulls first or nulls last select student-id, rank ( ) over (order by marks desc nulls last) as s-rank from student-marks Copyright: Silberschatz, Korth and Sudarshan

Copyright: Silberschatz, Korth and Sudarshan Ranking (Cont.) For a given constant n, the ranking the function ntile(n) takes the tuples in each partition in the specified order, and divides them into n buckets with equal numbers of tuples. E.g.: select threetile, sum(salary) from (select salary, ntile(3) over (order by salary) as threetile from employee) as s group by threetile Copyright: Silberschatz, Korth and Sudarshan

Copyright: Silberschatz, Korth and Sudarshan Windowing Used to smooth out random variations. E.g.: moving average: “Given sales values for each date, calculate for each date the average of the sales on that day, the previous day, and the next day” Window specification in SQL: Given relation sales(date, value) select date, sum(value) over (order by date between rows 1 preceding and 1 following) from sales Examples of other window specifications: between rows unbounded preceding and current rows unbounded preceding range between 10 preceding and current row All rows with values between current row value –10 to current value range interval 10 day preceding Not including current row Copyright: Silberschatz, Korth and Sudarshan

Copyright: Silberschatz, Korth and Sudarshan Windowing (Cont.) Can do windowing within partitions E.g. Given a relation transaction (account-number, date-time, value), where value is positive for a deposit and negative for a withdrawal “Find total balance of each account after each transaction on the account” select account-number, date-time, sum (value ) over (partition by account-number order by date-time rows unbounded preceding) as balance from transaction order by account-number, date-time Copyright: Silberschatz, Korth and Sudarshan