Download presentation
Presentation is loading. Please wait.
Published byMichael Sherman Modified over 9 years ago
1
DW-2: Designing a Data Warehousing System 용 환승 이화여자대학교 http://dblab.ewha.ac.kr/hsyong
2
ER Modeling Defines the Detailed Relationships Defines Entities That Are Fully Normalized Follows Third Normal Form or Greater Produces a Complex Database Design Stores Data at the Lowest Level of Transactional Detail Increases the Number of Joined Tables in Queries Is Fixed in Nature
3
Dimensional Modeling Defines Entities That Are Denormalized. Follows the Relational Model but Violates the ER Modeling Rules Produces a Simple Database Design That Is Easily Understood by Users Stores Data at the Lowest Level of Transactional Detail or Summarized Data Decreases the Number of Joined Tables in Queries Is Extendable
4
Modeling a Data Warehouse Using a Star Schema Components of a Star Schema Using a Snowflake Schema Choosing a Schema
5
Components of a Star SchemaEmployee_DimEmployee_Dim EmployeeKey EmployeeID... EmployeeID... EmployeeKeyTime_DimTime_Dim TimeKey TheDate... TheDate... TimeKeyProduct_DimProduct_Dim ProductKey ProductID... ProductID... ProductKey Customer_DimCustomer_Dim CustomerKey CustomerID... CustomerID... CustomerKeyShipper_DimShipper_Dim ShipperKey ShipperID... ShipperID... ShipperKey Sales_Fact TimeKey EmployeeKey ProductKey CustomerKey ShipperKey TimeKey EmployeeKey ProductKey CustomerKey ShipperKey RequiredDate... RequiredDate... TimeKey CustomerKey ShipperKey ProductKey EmployeeKey Multipart Key MeasuresMeasures Dimensional Keys
6
Using a Snowflake Schema Sales_Fact TimeKey EmployeeKey ProductKey CustomerKey ShipperKey TimeKey EmployeeKey ProductKey CustomerKey ShipperKey RequiredDate... RequiredDate... Product_Brand_IDProduct_Brand_ID Product Brand Product Category ID Product_Category_IDProduct_Category_ID Product Category Product Category ID Product_DimProduct_Dim ProductKey Product Name Product Size Product Brand ID
7
Star schema Snowflake schema Overall Row Count Higher Lower Model Understandability Easier More Difficult Number of Tables Less More Query Complexity Simpler More Complex Dimensional Searching Quicker Slower Bitmapped Indexing Supports Inhibits Choosing a Schema
8
Defining Dimension Characteristics Applying Characteristics to Dimension Tables Define a primary key Use descriptive character data Include highly correlated description columns Designing for Usability and Extensibility Minimize or avoid using codes or abbreviations Create columns that are useful for levels of aggregation Minimize the number of rows that will change over time
9
Identifying Dimension Hierarchies Consolidated Hierarchy Store Location ContinentContinent... CountryCountry StateState CityCity StoreStore Separate Hierarchy Store Location Continent... ContinentContinent Country... CountryCountry State or Province... State or Province City... CityCity Store number... Store Number 01...
10
Defining Conventional Dimensions Time Dimension Year, Quarter, Month, Week, Day, time Geographic Dimension Nation, state, city, district, location Product Dimension Customer Dimension
11
Sharing Dimensions Among Other Data Marts One instance exist and is shared among data marts TimeTime Multiple instances exist in individual data marts Sales Production Purchasing
12
Implementing a Star Schema Estimating Size of the Data Warehouse Creating a Database Creating Tables Creating Constraints Creating Indexes
13
Creating a Database Using CREATE DATABASE Options SIZE MAXSIZE FILEGROWTH Setting Database Options Read-only: No Locking Trunc. log on chkpt.: No Serious Recovery SELECT INTO/Bulkcopy : No Logging
14
Implementing of a Star Schema ( example )
15
Creating Tables sales_fact_1997 CREATE table sales_fact_1997 ( product_id int not null, customer_id int not null, store_id int not null, time_id int not null, store_sales float not null, store_cost float not null, unit_sales real not null ) sales_fact_1997 CREATE table sales_fact_1997 ( product_id int not null, customer_id int not null, store_id int not null, time_id int not null, store_sales float not null, store_cost float not null, unit_sales real not null ) Customer CREATE table Customer ( customer_id int not null, country char(50) not null, state_province char(50) not null, city char(50) not null, lname char(100) not null, primary key (customer_id) ) Customer CREATE table Customer ( customer_id int not null, country char(50) not null, state_province char(50) not null, city char(50) not null, lname char(100) not null, primary key (customer_id) ) Product CREATE table Product ( product_id int not null, product_class_id int not null, product_family char(50) not null, product_department char(50) not null, product_category char(50) not null, product_subcategory char(50) not null, brand_name char(255) not null, product_name char(255) not null, primary key (product_id) ) Product CREATE table Product ( product_id int not null, product_class_id int not null, product_family char(50) not null, product_department char(50) not null, product_category char(50) not null, product_subcategory char(50) not null, brand_name char(255) not null, product_name char(255) not null, primary key (product_id) ) CREATE table Store ( store_id int not null, store_country char(50) not null, store_state char(50) not null, store_city char(50) not null, primary key (store_id) ) CREATE table Store ( store_id int not null, store_country char(50) not null, store_state char(50) not null, store_city char(50) not null, primary key (store_id) ) CREATE table Time ( time_id int not null, the_month char(15) not null, quater char(2) not null, the_year int not null, primary key (time_id) ) CREATE table Time ( time_id int not null, the_month char(15) not null, quater char(2) not null, the_year int not null, primary key (time_id) ) Fact Table Dimension Tables
16
Implementing of a Star Schema ( example ) Data Importing using DTS ( Data Transform Services ) Using the Query result to specify the data
17
Implementing of a Star Schema ( example ) Specify the Table
18
Implementing of a Star Schema ( example ) Define FOREIGN KEY Constraints Creating Composite Indexes ALTER TABLE sales_fact_1997 ADD foreign key (customer_id) references Customer ALTER TABLE sales_fact_1997 ADD foreign key (product_id) references Product ALTER TABLE sales_fact_1997 ADD foreign key (time_id) references Time ALTER TABLE sales_fact_1997 ADD foreign key (store_id) references store ALTER TABLE sales_fact_1997 ADD foreign key (customer_id) references Customer ALTER TABLE sales_fact_1997 ADD foreign key (product_id) references Product ALTER TABLE sales_fact_1997 ADD foreign key (time_id) references Time ALTER TABLE sales_fact_1997 ADD foreign key (store_id) references store create index fact on sales_fact_1997 ( product_id, customer_id, store_id, time_id ) create index fact on sales_fact_1997 ( product_id, customer_id, store_id, time_id )
19
Transforming Data Transform Convert Combine Calculate buyer_namebuyer_name Adam Barr Sean Chai Erin O’Melia... reg_idreg_idItem_idItem_id 2 2 4 4 6 6 32 48 9 9... total_salestotal_sales 17.60 52.80 8.82... buyer_namebuyer_name Adam Barr Sean Chai Erin O’Melia... reg_idreg_idItem_idItem_id 2 2 4 4 6 6 32 48 9 9... total_salestotal_sales 17.60 52.80 8.82... buyer_namebuyer_name Adam Barr Sean Chai Erin O’Melia... reg_idreg_idItem_idItem_id 2 2 4 4 6 6 32 48 9 9... total_salestotal_sales 17.60 52.80 8.82... buyer_namebuyer_name Adam Barr Sean Chai Erin O’Melia... reg_idreg_idItem_idItem_id 2 2 4 4 6 6 1052 1023 1069... price_idprice_id.55 1.10.98... qty_idqty_id 32 48 9 9... buyer_namebuyer_name Adam Barr Sean Chai Erin O’Melia... reg_idreg_idItem_idItem_id II IV VI... 32 48 9 9... total_salestotal_sales 17.60 52.80 8.82... buyer_firstbuyer_first Adam Sean Erin... buyer_lastbuyer_last Barr Chai O’Melia... reg_idreg_idItem_idItem_id 2 2 4 4 6 6 32 48 9 9... total_salestotal_sales 17.60 52.80 8.82...
20
Transforming Data with a Lookup Query Data Warehouse Source Data Customer_sourceCustomer_source Name D. Smith L. Wilson P. Salinger State FL WY AR Look up Table Customer_dimCustomer_dim Name D. Smith L. Wilson P. Salinger State Florida Wyoming Arkansas Destination State_lookupState_lookup ST Abr.. FL WY AR State Florida Wyoming Arkansas Transform
21
Components of a Cube Period Product Location Sales Dimension Q4 Q1Q2Q3 Grapes Apples Melons Cherries Pears Atlanta Denver Detroit Member Cell Day 1 Day 2...... Week 1 Week 2...... JanuaryJanuaryFebruaryFebruary...... Levels Time Start Quarter 1 Quarter 2 Quarter 3 Quarter 4 July 1 October 1 January 1 April 1 End September 30 December 31 March 31 June 30 Properties
22
Storing Cubes Storing in a ROLAP Structure Storing in a MOLAP Structure Storing in a HOLAP Structure Comparing Storage Structures
23
Storing in a ROLAP Structure Data in OLAP Environment Data Mart or Data Warehouse Data Mart or Data Warehouse Oracle SQL Server Other RelationshipDatabase RelationshipDatabase RelationalDatabase ROLAP Data ROLAP Aggregations
24
Storing in a MOLAP Structure Data in OLAP Environment Data Mart or Data Warehouse Data Mart or Data Warehouse Oracle SQL Server Other MOLAPData MOLAP Data MOLAP Aggregations
25
Storing in a HOLAP Structure Data in OLAP Environment Data Mart or Data Warehouse Data Mart or Data Warehouse Oracle SQL Server Other MOLAPData MOLAPData ROLAP Data MOLAP Aggregations
26
Comparing Storage StructuresROLAPROLAP Base Data Storage Relational Table HOLAPHOLAP MOLAPMOLAP Cube Aggregation Storage Relational Table Cube Query Performance Fast Storage Consumption Low Faster Medium Fastest High Maintenance Low Medium High
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.