Dimensional Modeling: Advance Topics (chapt 11)
Chapter Objectives
Skema Snowflake
Jika tabel dimensi produk tidak di-indeks pada kaegori produk, query yang dilakukan pada kategori produk akan melakukan pencarian pada sebanyak 500.000 baris.
Jika tabel dimensi produk dinormalisasi terpisah masing-masing menjadi tabel brand produk dan tabel kategori produk, maka query pada kategori produk hanya akan mencari pada 10 baris pada tabel kategori produk.
Metode untuk normalisasi tabel dimensi
Advantages and Disadvantages
500.000 baris tabel dimensi produk. Dengan adanya snowflake, akan berkurang sebanyak 500.000 20-byte nama kategori produk. Saat yang sama, menambahkan 4-byte id-kategori pada tabel dimensi.
Storage yang dihemat : 500.000 x 16 = 8 MB
Jika rata-rata 500.000 baris menghabiskan 200 MB, maka yang dihemat adalah sekitar 4% storage
Snowflaking is not generally recommended in a data warehouse environment
Kapan menggunakan Skema Snowflake
Tabel Fakta Agregasi
All fact table rows where the customer key relates to customer number 12345678, the product key relates to product Widget-1, and the time key relates to the seven days in the first week of December 2008. Assuming that a customer may make at most one purchase of a single product in a single day, only a maximum of seven fact table rows participate in the summation
All fact table rows where the customer key relates to customer number 12345678, the product key relates to product Widget-1, and the time key relates to about 90 days of the first quarter of 2009. Assuming that a customer may make at most one purchase of a single product in a single day, only about 90 fact table rows or less participate in the summation
All fact table rows where the customer key relates to all customers in the south-central territory, the product key relates to all products in the product category Bigtools, and the time key relates to about 180 days in the first two quarters of 2009. In this case, clearly a large number of fact table rows participate in the summation
Query 3 akan membutuhkan waktu yang lama, karena sejumlah besar baris pada tabel fakta yang perlu diproses.
Solusi : gunakan aggregate tabel
Ukuran tabel fakta
Ukuran tabel fakta (cont)
Ukuran tabel fakta (cont)
Untuk memproses queri-queri tersebut, diperlukan selection dan summation pada baris tabel fakta.
Pada query ke-3, diperlukan data harian pada dimensi waktu (tgl 4 juli), tapi
berdasarkan kategori produk.
Jika pada tabel fakta sudah terdapat total summary, query akan diproses lebih cepat.
Kebutuhan untuk Aggregate
Aggregating Tabel Fakta
Aggregating Tabel Fakta
Digunakan saat mencapai ke level hirarki yang lebih tinggi pada dimensi yang satu dan mencapai ke level hirarki yang lebih rendah pada dimensi lain.
Aggregating Tabel Fakta
Digunakan saat mencapai ke level hirarki yang lebih tinggi pada dua dimensi dan mencapai ke level hirarki yang lebih rendah pada dimensi lain.
Aggregating Tabel Fakta
Digunakan saat mencapai ke level hirarki yang lebih tinggi pada semua dimensi.
Experienced data warehousing practitioners have a suggestion