ICS 421 Spring 2010 Data Warehousing 2 Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 3/30/20101Lipyeow.

Slides:



Advertisements
Similar presentations
12/18/20141 PSU’s CS Data Warehouses and Decision Support Len Shapiro, for CS386, 11/2-3/05. Some slides taken from Ramakrishnan and Gherke,
Advertisements

Outline What is a data warehouse? A multi-dimensional data model Data warehouse architecture Data warehouse implementation Further development of data.
Data Warehousing.
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.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 391 Database Systems I Data Warehousing.
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.
Data Warehousing & OLAP
1 OLAP and Decision Support Chapter 25, Part A. 2 Introduction  Increasingly, organizations are analyzing current and historical data to identify useful.
Data Warehouses and OLAP
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.
Dr. M. Sulaiman Khan Dept. of Computer Science University of Liverpool 2010 COMP207: Data Mining Data Warehousing COMP207: Data Mining.
CS 286, UC Berkeley, Spring 2007, R. Ramakrishnan 1 Decision Support Chapter 25.
COMP 578 Data Warehousing And OLAP Technology Keith C.C. Chan Department of Computing The Hong Kong Polytechnic University.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Data Warehousing and Decision Support Chapter 25, Part A.
1 Lecture 10: More OLAP - Dimensional modeling
© Tan,Steinbach, Kumar Introduction to Data Mining 8/05/ Data Warehouse and Data Cube Lecture Notes for Chapter 3 Introduction to Data Mining By.
Data Warehousing. On-Line Analytical Processing (OLAP) Tools The use of a set of graphical tools that provides users with multidimensional views of their.
CSE6011 Warehouse Models & Operators  Data Models  relations  stars & snowflakes  cubes  Operators  slice & dice  roll-up, drill down  pivoting.
1 Data Warehousing and OLAP. 2 Data Warehousing & OLAP Defined in many different ways, but not rigorously.  A decision support database that is maintained.
1 Data Warehouses C hapter 2. 2 Chapter 2 Outline Chapter 2 Outline – Introduction –Data Warehouses –Data Warehouse in Organisation – OLTP vs. OLAP –Why.
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.
CIS664-Knowledge Discovery and Data Mining
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Decision Support Chapter 23.
8/25/2015Data Mining: Concepts and Techniques 1 Data Mining: Concepts and Techniques — Chapter 3 — Jiawei Han Department of Computer Science University.
August 25, 2015Data Mining: Concepts and Techniques 1 Data Warehousing What is a data warehouse? A multi-dimensional data model Data warehouse architecture.
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
CPSC 404, Laks V.S. Lakshmanan 1 Data Warehousing & OLAP Chapter 25, Ramakrishnan & Gehrke (Sections )
Data warehouses and Online Analytical Processing.
 Data warehouses  Decision support  The multidimensional model  OLAP queries.
1 Data Warehousing and Decision Support. 2 Data Warehousing and OLAP Technology What is a data warehouse? A multi-dimensional data model Data warehouse.
Database Systems I Data Warehousing I NTRODUCTION Increasingly, organizations are analyzing current and historical data to identify useful patterns.
Data Warehousing Xintao Wu. Can You Easily Answer These Questions? What are Personnel Services costs across all departments for all funding sources? What.
1 Fall 2004, CIS, Temple University CIS527: Data Warehousing, Filtering, and Mining Lecture 2 Data Warehousing and OLAP Technology for Data Mining Lecture.
Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke1 Decision Support Chapter 23.
Data Warehouse & OLAP Kuliah 1 Introduction Slide banyak mengambil dari acuan- acuan yang dipakai.
Roadmap 1.What is the data warehouse, data mart 2.Multi-dimensional data modeling 3.Data warehouse design – schemas, indices 4.The Data Cube operator –
October 28, Data Warehouse Architecture Data Sources Operational DBs other sources Analysis Query Reports Data mining Front-End Tools OLAP Engine.
Knowledge Discovery and Data Mining Vasileios Megalooikonomou Dept. of Computer and Information Sciences Temple University Data Warehousing and OLAP Technology.
Dr. N. MamoulisAdvanced Database Technologies1 Topic 6: Data Warehousing & OLAP Defined in many different ways, but not rigorously. A decision support.
Shilpa Seth.  Multidimensional Data Model Concepts Multidimensional Data Model Concepts  Data Cube Data Cube  Data warehouse Schemas Data warehouse.
Data Warehousing Multidimensional Analysis
Data Mining Data Warehouses.
Data warehousing, data analysis and OLAP Sunita Sarawagi
OLAP & Data Warehousing. R. Ramakrishnan and J. Gehrke1 Decision Support Chapter 23.
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.
مثال ‌ هایی از شماهای پایگاه داده تحلیلی سید حسن فیروزآبادی.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Data Warehousing and Decision Support Chapter 25.
DATA WAREHOUSING – DIMENSIONAL MODELLING AND SCHEMAS With MIKE –AARONE ATUHE Handout 5.
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 Warehouses and OLAP. Data Warehousing and OLAP Technology for Data Mining  What is a data warehouse?  A multi-dimensional data model  Data warehouse.
Introduction to Data Warehousing
Information Management course
Pertemuan <<13>> Data Warehousing dan Decision Support
A multi-dimensional data model
OLAP Concepts and Techniques
Data Warehousing and OLAP Technology for Data Mining
Overview of Data Warehousing and OLAP
Data Warehousing and Decision Support Chapter 25
DATA CUBES E0 261 Jayant Haritsa Computer Science and Automation
Data Mining: Concepts and Techniques
Presented by: Tek Narayan Adhikari
Presentation transcript:

ICS 421 Spring 2010 Data Warehousing 2 Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 3/30/20101Lipyeow Lim -- University of Hawaii at Manoa

Data Warehouse Data Warehousing Integrated data spanning long time periods, often augmented with summary information. Several terabytes common. Interactive response times expected for complex queries; ad-hoc updates uncommon. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa2 Operational DBs External Data Sources DB ETL process periodicly (nightly, weekly) loads new data into data warehouse OLAP DATA MINING Extract, Transform, Load, Refresh Metadata

Warehousing Issues Semantic Integration: When getting data from multiple sources, must eliminate mismatches, e.g., different currencies, schemas. Heterogeneous Sources: Must access data from a variety of source formats and repositories. – Replication capabilities can be exploited here. Load, Refresh, Purge: Must load data, periodically refresh it, and purge too-old data. Metadata Management: Must keep track of source, loading time, and other information for all data in the warehouse. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa3

Multidimensional Data Model Collection of numeric measures, which depend on a set of dimensions. – E.g., measure Sales, dimensions Product (key: pid), Location (locid), and Time (timeid). 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa4 Product Time Location t-4t-3t-2t-1 L1 L2 L3

MOLAP vs ROLAP Multidimensional data can be stored physically in a (disk-resident, persistent) array; called MOLAP systems. Alternatively, can store as a relation; called ROLAP systems. The main relation, which relates dimensions to a measure, is called the fact table. Each dimension can have additional attributes and an associated dimension table. – E.g., Products(pid, pname, category, price) – Fact tables are much larger than dimensional tables. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa5

Dimension Hierarchies For each dimension, the set of values can be organized in a hierarchy: 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa6 all EuropeNorth_America MexicoCanadaSpainGermany Vancouver M. WindL. Chan... all region office country TorontoFrankfurtcity

Conceptual Design of Data Warehouses Fact table in BCNF; dimension tables un-normalized. – Dimension tables are small; updates/inserts/deletes are rare. So, anomalies less important than query performance. This kind of schema is very common in OLAP applications, and is called a star schema; computing the join of all these relations is called a star join. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa7 timeIDDateWeekMonthQuaterYear PidTimeidLocidSales PidPnameCategoryPriceLocidCityStateCountry Times Sales (Fact Table) Products Locations

Example: Star Schema 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa8 time_key day day_of_the_week month quarter year time location_key street city province_or_street country location Sales Fact Table time_key item_key branch_key location_key units_sold dollars_sold avg_sales Measures item_key item_name brand type supplier_type item branch_key branch_name branch_type branch A fact table in the middle connected to a set of dimension tables

Example: Snowflake Schema 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa9 time_key day day_of_the_week month quarter year time location_key street city_key location Sales Fact Table Measures item_key item_name brand type supplier_key item branch_key branch_name branch_type branch supplier_key supplier_type supplier city_key city province_or_street country city some dimensional hierarchy is normalized into a set of smaller dimension tables, forming a shape similar to snowflake time_key item_key branch_key location_key units_sold dollars_sold avg_sales

Example: Constellation 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa10 time_key day day_of_the_week month quarter year time location_key street city province_or_street country location Sales Fact Table Measures item_key item_name brand type supplier_type item branch_key branch_name branch_type branch Shipping Fact Table time_key item_key shipper_key from_location to_location dollars_cost units_shipped shipper_key shipper_name location_key shipper_type shipper galaxy schema or fact constellation : Multiple fact tables share dimension tables time_key item_key branch_key location_key units_sold dollars_sold avg_sales

OLAP Queries Influenced by SQL and by spreadsheets. A common operation is to aggregate a measure over one or more dimensions. – Find total sales. – Find total sales for each city, or for each state. – Find top five products ranked by total sales. Roll-up: Aggregating at different levels of a dimension hierarchy. – E.g., Given total sales by city, we can roll-up to get sales by state. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa11

More OLAP Queries Drill-down: The inverse of roll-up. – E.g., Given total sales by state, can drill-down to get total sales by city. – E.g., Can also drill-down on different dimension to get total sales by product for each state. Pivoting: Aggregation on selected dimensions. – E.g., Pivoting on Location and Time yields this cross-tabulation: Slicing and Dicing: Equality and range selections on one or more dimensions. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa12 Year\ State WICATotal Total Year Quarter Month Week

Comparison with SQL Queries The cross-tabulation obtained by pivoting can also be computed using a collection of SQLqueries: 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa13 SELECT SUM(S.sales) FROM Sales S, Times T, Locations L WHERE S.timeid=T.timeid AND S.locid=L.locid GROUP BY T.year, L.state SELECT SUM(S.sales) FROM Sales S, Times T WHERE S.timeid=T.timeid GROUP BY T.year SELECT SUM(S.sales) FROM Sales S, Location L WHERE S.locid=L.locid GROUP BY L.state Year\ State WICATotal Total

The CUBE Operator Generalizing the previous example, if there are k dimensions, we have 2^k possible SQL GROUP BY queries that can be generated through pivoting on a subset of dimensions. CUBE pid, locid, timeid BY SUM Sales – Equivalent to rolling up Sales on all eight subsets of the set {pid, locid, timeid}; each roll- up corresponds to an SQL query of the form: 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa14 SELECT SUM(S.sales) FROM Sales S GROUP BY grouping-list Lots of work on optimizing the CUBE operator Pid Locid Pid Timeid Locid Timeid Pid Timeid Locid All Pid,Locid,Timeid

Querying Sequences in SQL:1999 Trend analysis is difficult to do in SQL-92: – Find the % change in monthly sales – Find the top 5 product by total sales – Find the trailing n-day moving average of sales – The first two queries can be expressed with difficulty, but the third cannot even be expressed in SQL-92 if n is a parameter of the query. The WINDOW clause in SQL:1999 allows us to write such queries over a table viewed as a sequence (implicitly, based on user-specified sort keys) 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa15

The WINDOW Clause Let the result of the FROM and WHERE clauses be “Temp”. (Conceptually) Temp is partitioned according to the PARTITION BY clause. – Similar to GROUP BY, but the answer has one row for each row in a partition, not one row per partition! Each partition is sorted according to the ORDER BY clause. For each row in a partition, the WINDOW clause creates a “window” of nearby (preceding or succeeding) tuples. – Can be value-based, as in example, using RANGE – Can be based on number of rows to include in the window, using ROWS clause The aggregate function is evaluated for each row in the partition using the corresponding window. – New aggregate functions that are useful with windowing include RANK (position of a row within its partition) and its variants DENSE_RANK, PERCENT_RANK, CUME_DIST. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa16 SELECT L.state, T.month, AVG(S.sales) OVER W AS movavg FROM Sales S, Times T, Locations L WHERE S.timeid=T.timeid AND S.locid=L.locid WINDOW W AS (PARTITION BY L.state ORDER BY T.month RANGE BETWEEN INTERVAL `1’ MONTH PRECEDING AND INTERVAL `1’ MONTH FOLLOWING)

Top K Queries If you want to find the 10 (or so) cheapest cars, it would be nice if the DB could avoid computing the costs of all cars before sorting to determine the 10 cheapest. – Idea: Guess at a cost c such that the 10 cheapest all cost less than c, and that not too many more cost less. Then add the selection cost<c and evaluate the query. If the guess is right, great, we avoid computation for cars that cost more than c. If the guess is wrong, need to reset the selection and recompute the original query. 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa17

Example: Top K Queries FETCH FIRST 10 ROWS ONLY is not in SQL99 Cut-off value c is chosen by optimizer 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa18 SELECT P.pid, P.pname, S.sales FROM Sales S, Products P WHERE S.pid=P.pid AND S.locid=1 AND S.timeid=3 ORDER BY S.sales DESC FETCH FIRST 10 ROWS ONLY SELECT P.pid, P.pname, S.sales FROM Sales S, Products P WHERE S.pid=P.pid AND S.locid=1 AND S.timeid=3 AND S.sales > c ORDER BY S.sales DESC

Online Aggregation Consider an aggregate query, e.g., finding the average sales by state. Can we provide the user with some information before the exact average is computed for all states? – Can show the current “running average” for each state as the computation proceeds. – Even better, if we use statistical techniques and sample tuples to aggregate instead of simply scanning the aggregated table, we can provide bounds such as “the average for Wisconsin is 2000  102 with 95% probability. Should also use nonblocking algorithms! 3/30/2010Lipyeow Lim -- University of Hawaii at Manoa19