Académique Documents
Professionnel Documents
Culture Documents
Agenda
www.Delphix.com
28-Sep 2014
A short story
www.Delphix.com
28-Sep 2014
A short story
o DW architect added
This setup has been running in PROD for 10 months!
o In other words, everything is OK! Stop causing trouble!
www.Delphix.com
28-Sep 2014
www.Delphix.com
28-Sep 2014
Dimensional
Modeling
Customers
Suppliers
Orders
Products
Order Facts
Order Lines
www.Delphix.com
Customers Dim
Time Dim
28-Sep 2014
Why Star
Transformations?
Dim
Table1
Star transformation
compared to other
join methods (NL,
SM, HA):
Dim
Table2
Dim
Table3
Dim
Table4
www.Delphix.com
Fact
table
Why Star
Transformations?
Dim
Table1
Dim
Table2
Dim
Table3
Dim
Table4
www.Delphix.com
Star
transformation:
Filter on query
set in each
dimension
Merge result set
from all
dimensions
Join to the fact
from merged
result set, using
Oracle Open World 2014 BITMAP MERGE
28-Sep 2014
Why Star
Transformations?
Point: Single-column bitmap indexes on
dimension-key columns are required for star
transformation
Counter-point: Bitmap indexes become
impossible to load/maintain when data volume
increases past dozens of Gb
Catch-22? Does this mean that Oracle cannot
handle large data warehouses?
www.Delphix.com
28-Sep 2014
28-Sep 2014
10
www.Delphix.com
28-Sep 2014
11
28-Sep 2014
12
28-Sep 2014
13
28-Sep 2014
14
Exchange Partition
www.Delphix.com
28-Sep 2014
15
step 1
Hashpartitioned
tableTXN_SWAP
Compositepartitioned
tableTXN
CREATE TABLE
TXN_SWAP
AS SELECT
FROM TXN
PARTITION
(P20140225)
22Feb
2014
www.Delphix.com
23Feb
2014
24Feb
2014
25Feb
2014
Oracle Open World 2014
28-Sep 2014
16
step 2
Hashpartitioned
tableTXN_SWAP
Compositepartitioned
tableTXN
Load
Load
Load
22Feb
2014
www.Delphix.com
23Feb
2014
24Feb
2014
25Feb
2014
Oracle Open World 2014
28-Sep 2014
17
step 3
Hashpartitioned
tableTXN_SWAP
Compositepartitioned
tableTXN
CREATE
INDEX
CREATE
INDEX
CREATE
INDEX
22Feb
2014
www.Delphix.com
23Feb
2014
24Feb
2014
25Feb
2014
Oracle Open World 2014
28-Sep 2014
18
step 4
Hashpartitioned
tableTXN_SWAP
Compositepartitioned
tableTXN
EXCHANGE
PARTITIO
N
22Feb
2014
www.Delphix.com
23Feb
2014
24Feb
2014
25Feb
2014
Oracle Open World 2014
28-Sep 2014
19
step 5
Hashpartitioned
tableTXN_SWAP
Compositepartitioned
tableTXN
Gather
partition
statistics
for table,
columns,
indexes
22Feb
2014
www.Delphix.com
23Feb
2014
24Feb
2014
25Feb
2014
Oracle Open World 2014
28-Sep 2014
20
Exchange Partition
1. Create temporary table TXN_SWAP as a hashpartitioned table
2. Perform parallel, direct-path load of new data into
TXN_SWAP
Perform any other DML needed to prepare data in
TXN_SWAP for publishing into the TXN table
3. Create indexes on TXN_SWAP corresponding to the local
indexes on TXN
4. Exchange partition to publish new data to TXN
alter table TXN
exchange partition P20140225 with table TXN_SWAP
including indexes update global indexes;
28-Sep 2014
21
Exchange Partition
28-Sep 2014
22
www.Delphix.com
28-Sep 2014
23
1.Use EXCHPART package to load the data for the 25Feb and 24-Feb partitions
2.Load the data to the remainder of the partitions by
just inserting (conventional-path) directly into the
partitioned table
www.Delphix.com
28-Sep 2014
24
28-Sep 2014
25
Slowly-changing
dimensions
Loading time-variant fact and dimension tables is
not the only load activity in most data
warehouses
o Often, some tables contain current or point-in-time data
Example: type-1 dimension derived from type-2 dimension
www.Delphix.com
28-Sep 2014
26
28-Sep 2014
27
ExchPart instead of
MERGE
CURR_ACCT_DIM
(type1dimension)
ACCT_DIM
(type2dimension)
ACCT_DIM_SWAP
Truncatedas
webegin
Data
current
asof24
Feb
22Feb
2014
23Feb
2014
www.Delphix.com
24Feb
2014
25Feb
2014
Justloaded25Febdata
Oracle Open World 2014
28-Sep 2014
28
ExchPart instead of
MERGE
INSERT/*+appendparallel(t,8)*/INTOTMP_CURR_ACCOUNT_DIMT
SELECT/*+parallel(x,8)*/(list of columns)
FROM (SELECT/*+parallel(y,8)*/(list of columns),
ROW_NUMBER()over(PARTITIONBYacctkey
ORDERBYeffdtdesc)rn
FROM(SELECT/*+parallel(z1,8)*/(list of columns)
FROMCURR_ACCOUNT_DIMz1
UNIONALL
SELECT/*+parallel(z2,8)*/(list of columns)
FROMACCOUNT_DIMpartition(P20140225)z2)y)x
WHEREx.RN=1;
1.Inner-most query pulls changed data from type-2, merged with existing data
from type-1
2.Middle query ranks within ACCTKEY values, sorted by EFFDT DESC
3.Outer-most query selects only latest row for each ACCTKEY and passes to
INSERT
www.Delphix.com
28-Sep 2014
29
ExchPart instead of
MERGE
CURR_ACCT_DIM
(type1dimension)
ACCT_DIM
(type2dimension)
All rows
All
rows
22Feb
2014
23Feb
2014
www.Delphix.com
24Feb
2014
ACCT_DIM_SWAP
unio
n all
filter
25Feb
2014
28-Sep 2014
30
ExchPart instead of
MERGE
CURR_ACCT_DIM
(type1dimension)
ACCT_DIM
(type2dimension)
ACCT_DIM_SWAP
CREAT
E
INDEX
CREAT
E
INDEX
CREAT
E
INDEX
22Feb
2014
23Feb
2014
www.Delphix.com
24Feb
2014
25Feb
2014
28-Sep 2014
31
ExchPart instead of
MERGE
CURR_ACCT_DIM
(type1dimension)
ACCT_DIM
(type2dimension)
ACCT_DIM_SWAP
EXCHANGE
PARTITIO
N
22Feb
2014
23Feb
2014
www.Delphix.com
24Feb
2014
25Feb
2014
28-Sep 2014
32
ExchPart instead of
MERGE
CURR_ACCT_DIM
(type1dimension)
ACCT_DIM
(type2dimension)
ACCT_DIM_SWAP
Gather
partition
statistics
for table,
columns,
indexes
22Feb
2014
23Feb
2014
www.Delphix.com
24Feb
2014
25Feb
2014
28-Sep 2014
33
Summary
1. Data warehouses use star schemas
2. Star schemas are best queried using star
transformations
3. Star transformation requires bitmap indexes
o
28-Sep 2014
34
KScope15
http://www.KScope15.com
#ODTUG
#KScope15
Conference for EPM, APEX, ADF, BI, Oracle developers and DBAs
www.Delphix.com
28-Sep 2014
35
Q&A
Session: UGF-3587
Email: Tim.Gorman@Delphix.com
Twitter: @TimothyJGorman
Blog: EvDBT.com
o Papers:
EvDBT.com/papers
o Scripts:
EvDBT.com/scripts
o Videos: EvDBT.com/videos
www.Delphix.com
28-Sep 2014
36