6. การคลังข้อมูล (Data Warehousing)
กระบวนการใน Data Warehousing ประกอบไปด้วย
Data
Warehouse
Data
Source 1
Data
Source 2
Data
Source 3
Data Resources Data Staging Data Store
Data Provisioning
หรือ Data Mart
Staging
Database
Data Data
Cleaning
and
Filtering
6
13. แบบจาลองของ Data Warehouse
ก่อนที่จะทาการออกแบบ ต้องศึกษาส่วนประกอบของ แบบจาลองพื้นฐานซึ่ง
ประกอบด้วย ดังนี้
ส่วนประกอบ รายละเอียด
Fact table เป็นตารางศูนย์กลางที่ใช้ใน data warehouse และ data
mart ที่จะเก็บจานวน measures และรายละเอียดสาคัญ
ในเชิงธุรกิจ
Fact คือ row ในตาราง โดย fact จะเก็บค่าตัวเลขที่ใช้วัด
เหตุการณ์ที่เกิดขึ้น
Measure คือ ปริมาณ, จานวน column ใน fact table โดย
measure จะแสดงให้เห็นถึงค่าที่ถูกวิเคราะห์แล้ว
Dimension คือ เอกลักษณ์ทางธุรกิจเป็นลักษณะทางกายภาพ
Dimension table เป็นตารางใน data warehouse หรือ data mart ที่
อธิบายข้อมูลใน fact table
13
14. Star Schema
star schema จะมีลักษณะที่มี fact table อยู่ตรงกลางล้อมรอบด้วยหลาย ๆ
dimension table ที่เก็บรายละเอียดของ fact ที่ไม่ใช่ normalized center
14
15. Star Schema
Store Key
Product Key
Period Key
Units
Price
Store Dimension Time Dimension
Product Dimension
Fact Table
Store Key
Store Name
City
State
Region
Period Key
Year
Quarter
Month
Product Key
Product Desc
15
16. Star Schema
Store Dimension
Time Dimension
Product Dimension
Fact Table
Store Key
Store Name
City
State
Region
Period Key
Year
Quarter
Month
Product Key
Product Desc
Dimension tables
Dimension
Store Key Product
Key
Period
Key
Units Price
Fact
16
17. Snowflake Schema
Store Key
Product Key
Period Key
Units
Price
Time Dimension
Product Dimension
Fact Table
Store Key
Store Name
City Key
Period Key
Year
Quarter
Month
Product Key
Product Desc
City Key
City
State
Region
City Dimension
Store Dimension
• Snowflake schema มีความแตกต่างจาก Star schema ตรงที่ dimension table จะเก็บ
ข้อมูลจะเก็บข้อมูลที่อยู่ในรูป normal form
17
25. Sale Data warehouse Model
City Product Month Units Rupees
Mumbai Wheat Bread January 3 7.95
Mumbai Cheese January 4 7.32
Pune Wheat Bread January 3 7.95
Pune Cheese January 4 7.32
Mumbai Swiss Rolls February 16 42.40
City_ID Prod_ID Month Units Rupees
1 589 1/1/1998 3 7.95
1 1218 1/1/1998 4 7.32
2 589 1/1/1998 3 7.95
2 1218 1/1/1998 4 7.32
1 580 2/1/1998 16 42.40
25
26. เริ่มดาเนินการกับการทา OLAP
City Product Month Units Rupees
Mumbai Wheat Bread January 3 7.95
Mumbai Cheese January 4 7.32
Pune Wheat Bread January 3 7.95
Pune Cheese January 4 7.32
Mumbai Wheat Bread February 16 42.40
26
31. Drill down & Roll up
Roll Up
Drill Down
January February March April
14 41 33 25
Jan Feb Mar Apr
Wheat Bread 6 6 17
Cheese 8 16 6 8
Swiss Rolls 25 21
Jan Feb Mar Apr
Mumbai Wheat Bread 3 3 10
Cheese 4 16 6
Swiss Rolls 16 6
Pune Wheat Bread 3 3 7
Cheese 4 8
Swiss Rolls 9 15
31
32. Slide
Time
Product
Product= Swiss Rolls
Wheat Bread
Cheese
Swiss Rolls
Mumbai
Pune
Ahemdabad
Baroda
Jan Feb March Apr
Time
Jan Feb March Apr
3 10
3 7
1 1 1 2
10 5 3 4
10 5 3 4
3 10
3 7
1 1 1 2
32