S1 Teknik Informatika Fakultas Teknologi Informasi Universitas Kristen Maranatha
• A cell in the cube may store values (measurements) relative to the combination of the labeled dimensions Sales of DVDs in NY in August
NY
product
DVD
DIMENSIONS PRODUCT LOCATION TIME category region year product
country
quarter
month
Agt
state month city store
day
week
Store
Total Sales
Product 1
Store
1 $454
2
3
4
-
-
$925
-
-
2 $468 $800 3 $296
-
$240
4 $652
-
$540 $745
DM-MA/S1IF/FTI/UKM/2010
800
Product
3
Dimensional modeling adalah teknik untuk menstrukturkan
data menurut konsep bisnis. Dimensional model meliputi : measures, ex: sales-in-items, sales-in-pound, dll. dimensions, ex: time, space, products Dimension dapat distrukturkan (menyediakan view-view yang kurang/lebih detil) untuk summarize/analyze data Dapat dibandingkan dengan : ER model : “entities” and “relationships” UML schema : “classes” DM-MA/S1IF/FTI/UKM/2010
4
Measure(s) – Data numerik Misalnya jumlah produk permen yang dijual di toko X pada
tanggal 2 Maret 2006 Dimension(s) – parameter bisnis yang menentukan
transaksi. Misalnya : product, time, location
Dimension(s) dan measure(s) menentukan “cube” Analis ingin melihat data penjualan (measure) berdasarkan
geography, time, dan product (dimensions) Tampilkan penjualan dari tahun 2006 sd 2009 di Bandung dan Jakarta untuk produk P1,P2,P3 DM-MA/S1IF/FTI/UKM/2010
5
Tiap dimension menggambarkan sebuah “business entity” Dimension melibatkan atribut-atribut yang menjelaskan data
numerik/measure Tiap dimension harus mempunyai single base level, yaitu level dengan granularity terbaik “day” dapat menjadi base level untuk “time” dimension “products” dapat menjadi base level untuk “product” dimension “store” dapat menjadi base level untuk “location dimension”
DM-MA/S1IF/FTI/UKM/2010
6
Elemen base level tadi nanti dapat di aggregate/summarized
ke level yang lain. “days” weeks, months, quarter, year, .... “products” brand, food/non-food, supplier, .... “store” city, region, country, urban/rural, ....
Elemen dimension adalah sesuatu yang masuk akal, tidak
bergantung pada dimension lain Tiap level terdiri dari sekumpulan atribut Dalam “month” level, kita mengelompokkan seluruh “days” sehingga
sesuai dengan atribut month dan year Dalam “supplier” level, kita mengelompokkan seluruh “products” sehingga sesuai dengan atribut supplier DM-MA/S1IF/FTI/UKM/2010
7
DM-MA/S1IF/FTI/UKM/2010
8
DM-MA/S1IF/FTI/UKM/2010
9
DM-MA/S1IF/FTI/UKM/2010
10
Dimension mempunyai attribute Time dimension: day, month, year Product dimension: ProductID, LineID, BrandID
Dimension distrukturkan/diorganisasikan dalam hierarchy Time dimension: days weeks quarters Product dimension: product product line brand
Attribute menentukan level dari suatu elemen dimension
DM-MA/S1IF/FTI/UKM/2010
11
Disebut juga Multidimensional data Untuk memvisualiasasikan data dengan 1-3 dimensi. Untuk dimensi lebih tinggi, digunakan hypercube.
DM-MA/S1IF/FTI/UKM/2010
12
DM-MA/S1IF/FTI/UKM/2010
13
DM-MA/S1IF/FTI/UKM/2010
14
Roll-up : melihat view yang lebih summarized Drill-down : melihat view yang lebih detil Slice and dice : melihat subview / subcube / bagian
tertentu saja dari data Pivoting : merotasikan row/column/dimension untuk melihat keadaan tertentu Ranking : top-N analysis
DM-MA/S1IF/FTI/UKM/2010
15
DM-MA/S1IF/FTI/UKM/2010
16
Agregasi data ke level yang lebih tinggi Climbing up hierarchy Dimension reduction
Contoh : roll-up sales (berdasar store,day, product) ke
average-sales (berdasar region, month, brand) Untuk tiap dimension : up ke level mana ? Untuk tiap measure : fungsi agregasi mana yang akan digunakan ? (Sum, average, min, max, count ?)
DM-MA/S1IF/FTI/UKM/2010
17
Melihat data ke level yang lebih rendah / lebih tersebar
(reverse roll-up) Contoh : drill down sales (berdasar region, month, brand) ke sales (berdasar store, month, product) Untuk tiap dimension : down ke level mana ? Untuk measure : drill down seringkali dapat dipakai sebagai ‘undo’ agregasi
DM-MA/S1IF/FTI/UKM/2010
18
DM-MA/S1IF/FTI/UKM/2010
19
DM-MA/S1IF/FTI/UKM/2010
20
DM-MA/S1IF/FTI/UKM/2010
21
DM-MA/S1IF/FTI/UKM/2010
22
Hanya melihat bagian tertentu dari data saja (proyeksi
dan seleksi) Contoh : slice sales (berdasar region, month, brand) ke sales
(berdasar month, brand) untuk region NW saja. Untuk dimension : tentukan bagian mana yang akan tetap ada
Untuk measure : tidak ada agregasi
DM-MA/S1IF/FTI/UKM/2010
23
DM-MA/S1IF/FTI/UKM/2010
24
Pivot : merotasikan data, dapat dikombinasikan dengan slicing
Ranking : melakukan top-N analysis
Kombinasi : mengkombinasikan beberapa cube sehingga dapat
dibandingkan
DM-MA/S1IF/FTI/UKM/2010
25
DM-MA/S1IF/FTI/UKM/2010
26
it
i
nt
(c
605
lo
t ca
USA n io Canada
Q2
time (quarters)
Q1
computer home entertainment
Q1
Fig. 3.10 Typical OLAP Operations
Q4 computer security phone home entertainment item (types)
roll-up on location (from cities to countries)
s)
(
Chicago 440 New York 1560 Toronto 395 c lo Vancouver
on
time (quarters)
i at
slice for time = “Q1”
location (cities)
ie
1000
Q3
dice for (location = “Toronto” or “Vancouver”) and (time = “Q1” or “Q2”) and (item = “home entertainment” or “computer”)
t ci
2000
Q2
item (types)
Q1
605
825
14
400
Q2 Q3 Q4 computer security phone home entertainment
drill-down on time (from quarters to months)
item (types) Chicago New York Toronto
)
es
Vancouver 605
825
14
ti
400
i (c
Chicago New York Toronto lo Vancouver January
computer security
t ca
home phone entertainment item (types)
n io
February
time (months)
March pivot
item (types)
r
ou (c
Toronto 395 Vancouver
time (quarters)
t ca lo
n io
home entertainment
605
computer
825
May June July August October November December
400
security
April
September
14
phone
150 100 150
computer security New York Vancouver Chicago
Toronto
location (cities)
DM-MA/S1IF/FTI/UKM/2010
phone home entertainment item (types)
27
Modeling data warehouses: 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
DM-MA/S1IF/FTI/UKM/2010
28
DM-MA/S1IF/FTI/UKM/2010
29
DM-MA/S1IF/FTI/UKM/2010
30
DM-MA/S1IF/FTI/UKM/2010
31
DM-MA/S1IF/FTI/UKM/2010
32
Mudah dipahami
Performance kurang baik
Hirarki mudah dilihat : 1
Dimension bisa menjadi
dimension dalam 1 table, hirarki ada secara implisit di tabel Mengurangi jumlah physical join (dibanding snowflake) Low maintenance Meta data-nya simple
sangat banyak
DM-MA/S1IF/FTI/UKM/2010
33
DM-MA/S1IF/FTI/UKM/2010
34
DM-MA/S1IF/FTI/UKM/2010
35
Tidak perlu lagi penanda
Performance bisa lebih
level. 1 table per dimension / per agregated fact / per kombinasi level
lambat Front end harus bisa mendeteksi adanya agregated fact sehingga meta data harus lebih banyak Untuk menjawab single query mungkin butuh multiple SQL statement
DM-MA/S1IF/FTI/UKM/2010
36
Star, alternatifnya fact constellation. Jika high cardinality (atribut & tuple banyak), sub select
dimension bisa relatif lambat. Alternatif lainnya : snowflake 1 table per dimension level
DM-MA/S1IF/FTI/UKM/2010
37
DM-MA/S1IF/FTI/UKM/2010
38
DM-MA/S1IF/FTI/UKM/2010
39
Untuk tiap level dari dimension, dibuat 1 tabel. Tiap tabel berisi atributnya ditambah ‘parent key’-nya Misal : dimension time (day,month,week,quarter,year)
dipecah menjadi time1(day,week,month), time2a(week,year), time2b(month,quarter), time3(quarter,year)
DM-MA/S1IF/FTI/UKM/2010
40
Pahami dimension dan level-level di dalamnya Select mulai dari fact table Pembuatan snowflake : mulai dari star, baru di-snowflake-
kan dengan query-query
DM-MA/S1IF/FTI/UKM/2010
41
DW collects information about subjects that span the
entire organization, such as customers, products, sales, assets, and personnel. Its scope is enterprise-wide. For DW, fact constellation schema is commonly used since it can model multiple, interrelated subjects. Data Mart is a subset of a DW, focuses on a particular subject. Its scope is department-wide. Typically, a data mart consisting of a single subject area (e.g. marketing, operations). For Data Mart, star or snowflake schema are commonly used since both are geared towards modeling single subject DM-MA/S1IF/FTI/UKM/2010
42
A data mart can be either dependent or independent. A dependent data mart is a subset that is created directly
from the DW. Consistent data model Providing quality data DW must be constructed first Ensures that the user viewing the same version of the data
that are accessed by all other data warehouse users An independent data mart is a small warehouse designed
for a department, its source is not an enterprise DW DM-MA/S1IF/FTI/UKM/2010
43
Data Penjualan di Toko Cabang-1 Jan
Feb
Mar
Apr
Mei
Jun
Produk-1
100
40
90
40
20
50
Produk-2
70
50
30
100
30
80
Produk-3
80
30
60
50
100
60
Produk-4
50
70
70
60
50
70
Produk-5
60
80
50
40
80
30
DM-MA/S1IF/FTI/UKM/2010
44
Data Penjualan di Toko Cabang-2 Jan
Feb
Mar
Apr
Mei
Jun
Produk-1
50
70
80
140
100
30
Produk-2
70
50
50
50
30
80
Produk-3
90
60
20
70
80
90
Produk-4
150
70
70
60
50
70
Produk-5
60
40
40
50
60
70
DM-MA/S1IF/FTI/UKM/2010
45
Untuk setiap query berikut ini : tentukan operator OLAP apa yang harus dilakukan terhadap data di atas, sehingga
dapat memberikan informasi yang diperlukan tunjukkan tampilan informasi yang dihasilkan
Query yang harus dijawab : Tampilkan jumlah penjualan di seluruh toko cabang untuk semua produk
dalam satu semester Tampilkan produk yang mempunyai penjualan terbesar di toko cabang-1 untuk bulan Maret Tampilkan rata-rata penjualan setiap produk di toko cabang-2 per triwulan (tiga bulan) Tampilkan data penjualan di seluruh toko cabang dari bulan Februari s.d April Tampilkan data penjualan di seluruh cabang untuk Produk 2 DM-MA/S1IF/FTI/UKM/2010
46