SlideShare a Scribd company logo
1 of 28
Download to read offline
SCD2 mal anders
Andrej Pashchenko
Senior Consultant, Düsseldorf
@Andrej_SQL doag2017
Unser Unternehmen.
Trivadis DOAG17: SCD2 mal anders2 29.11.2018
Trivadis ist führend bei der IT-Beratung, der Systemintegration, dem Solution
Engineering und der Erbringung von IT-Services mit Fokussierung auf -
und -Technologien in der Schweiz, Deutschland, Österreich und
Dänemark. Trivadis erbringt ihre Leistungen aus den strategischen Geschäftsfeldern:
Trivadis Services übernimmt den korrespondierenden Betrieb Ihrer IT Systeme.
B E T R I E B
KOPENHAGEN
MÜNCHEN
LAUSANNE
BERN
ZÜRICH
BRUGG
GENF
HAMBURG
DÜSSELDORF
FRANKFURT
STUTTGART
FREIBURG
BASEL
WIEN
Mit über 600 IT- und Fachexperten bei Ihnen vor Ort.
Trivadis DOAG17: SCD2 mal anders3 29.11.2018
14 Trivadis Niederlassungen mit
über 600 Mitarbeitenden.
Über 200 Service Level Agreements.
Mehr als 4'000 Trainingsteilnehmer.
Forschungs- und Entwicklungsbudget:
CHF 5.0 Mio. / EUR 4.0 Mio.
Finanziell unabhängig und
nachhaltig profitabel.
Erfahrung aus mehr als 1'900 Projekten
pro Jahr bei über 800 Kunden.
Über mich
Trivadis DOAG17: SCD2 mal anders4 29.11.2018
Senior Consultant bei der Trivadis GmbH, Düsseldorf
Schwerpunkt Oracle
– Data Warehousing
– Application Development
– Application Performance
Kurs-Referent „Oracle 12c New Features für Entwickler“
und „TechnoCircle Oracle 12c Release 2“
Blog: http://blog.sqlora.com
Agenda
Trivadis DOAG17: SCD2 mal anders5 29.11.2018
1. Introduction and state of the art
2. The „new“ approach
3. Use cases and performance
4. Conclusion
Trivadis DOAG17: SCD2 mal anders6 29.11.2018
Introduction and state of the art
Introduction
Trivadis DOAG17: SCD2 mal anders7 29.11.2018
Historization? As a part of loading process in a data warehouse
We consider Slowly Changing Dimensions Type II
All changes are completely tracked. The change in at least one of the tracked
columns toggles the creation of the new version record
The most challenging task is the change detection
DWH_KEY VALID_FROM VALID_TO CUR_VERSION ETL_OP BUS_KEY FIRST_NAME SECOND_NAMES LAST_NAME HIRE_DATE FIRE_DATE SALARY
1 01.12.2016 02.12.2016 N UPD 123 Roger Federer 01.01.2010 900000
11 03.12.2016 Y INS 123 Roger Federer 01.01.2010 920000
6 02.12.2016 02.12.2016 N UPD 345 Venus Williams 01.11.2016 500000
10 03.12.2016 Y INS 345 Venus Williams 01.11.2016 01.12.2016 500000
2 01.12.2016 02.12.2016 N UPD 456 Rafael Nadal 01.05.2009 720000
3 01.12.2016 01.12.2016 N UPD 789 Serena Williams 01.06.2008 650000
5 02.12.2016 Y INS 789 Serena Jameka Williams 01.06.2008 650000
State of the Art
Trivadis DOAG17: SCD2 mal anders8 29.11.2018
Typical OWB mapping
BK_T C1_T C2_T
11 A BB
22 D E
77 M N
33 F G
State of the Art
Trivadis DOAG17: SCD2 mal anders9 29.11.2018
BK C1 C2
11 A B
22 D E
44 K L
77 M
BK C1 C2
11 A BB
22 D E
33 F G
77 M N
BK_S C1_S C2_S
11 A B
22 D E
44 K L
77 M
NVL(C2_S,'(NULL)') != NVL(C2_T,'(NULL)')
LNNVL(C2_S = C2_T) AND NVL(C2_S, C2_T) IS NOT NULL
DECODE, STANDARD_HASH, SYS_OP_MAP_NONNULL …
Full
Outer
Join
Change
Detection?
Old
Versions
New
Versions
Old
New
Target
Source
Target
Split
UNION ALL
MERGE
More on delta detection: https://danischnider.wordpress.com/2016/10/08/delta-detection-in-oracle-sql/
Data to the left has to be
accessed twice!
State of the Art
Trivadis DOAG17: SCD2 mal anders10 29.11.2018
Change detection must be done with respect to null values
Comparing each and every column in a complex way
Or maintaining and comparing hash-diffs: common rules needed, re-hashing after
structural changes sometimes needed
Full outer join may be expensive if not working with „deltas“
Splitting the join result into two data sets causes this join to be made twice
Another
solution?
Trivadis DOAG17: SCD2 mal anders11 29.11.2018
The „new“ approach
The „new“ approach
Trivadis DOAG17: SCD2 mal anders12 29.11.2018
The „new“ approach is not really new
Oft used for ad hoc queries
Are these two records different?
Using Group BY
BK C1 C2 C3 C4 … … C467 C468 C469
11 A B C D … … AA BB CC
11 A B C D … … AB BB CC
SELECT COUNT(*)
FROM t
GROUP BY BK, C1, C2, C3, C4, … C467, C468, C469
The „new“ approach
Trivadis DOAG17: SCD2 mal anders13 29.11.2018
Or using analytical function:
If count equals 2 – they are the same
If count equals 1 – they are different
For GROUP BY and PARTITION BY:
NULL=NULL, VALUE!=NULL
SELECT COUNT(*) OVER (PARTITION BY BK, C1, C2, C3, … C468, C469)
FROM t;
But what
about NULLs?
BK C1 C2
11 A BB
33 F G
77 M N
S_T BK C1 C2
T 11 A BB
T 22 D E
T 33 F G
T 77 M N
The „new“ approach
Trivadis DOAG17: SCD2 mal anders14 29.11.2018
BK C1 C2
11 A B
22 D E
44 K L
77 M
BK C1 C2
11 A BB
22 D E
33 F G
77 M N
UNION ALL
Target
Source
Target
GROUP BY MERGE
S_T BK C1 C2
S 11 A B
S 22 D E
S 44 K L
S 77 M
MIN
(S_T)
S
S
S
S
T
T
T
DEMO!
BK C1 C2
11 A B
22 D E
44 K L
77 M
CNT
1
2
1
1
1
1
1
The „new“ approach
Trivadis DOAG17: SCD2 mal anders15 29.11.2018
An unconventional approach for ETL of historized data16 19.03.2017
Use Cases and Performance
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders17 29.11.2018
Source
Older
Versions
Full Data
Current
VersionsJOIN
may be
slow
Filter
may be
slow
Partitio-
ning?
Target
Full Data Load
Full Data
Current
Versions
Group By
may be
slow
UNION ALLLegacy New
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders18 29.11.2018
Source
Delta
JOIN Filter
may be
slow
Partitio-
ning?
Older
Versions
Current
Versions
Target
Delta Load
Delta
Current
Versions
Group By
may be
slow
UNION ALLLegacy New
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders19 29.11.2018
Source
Older
Versions
Delta
Current
Versions
JOIN
Filter
Business_key
IN …
Target
Delta Load with pre-filter
Delta
Current Ver-
sions (filtered)
Group By
fast
UNION ALLLegacy New
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders20 29.11.2018
Data Warehouse with Siebel-CRM as a source
Order table S_ORDER – 120 columns „only“
Comparing legacy approach vs. GROUP BY vs. analytical functions
Full staging table as a source vs. delta (with or without pre-filtering)
Ca. 6 Mio rows in the target table
Ca. 3 Mio rows in the full load dataset
Ca. 3000 rows in the delta load dataset
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders21 29.11.2018
Method Delta Load, min Full Load, min
Outer Join (legacy approach) 0:09 0:41
GROUP BY 1:10 1:04
GROUP BY with pre-filter 0:04 N/A
Analytic Function 2:12 4:52
Analytic with pre-filter 0:12 N/A
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders22 29.11.2018
Execution Plan
--------------------------------------------------------------------------------------------
| Id | Operation | Name | A-Rows | A-Time |
--------------------------------------------------------------------------------------------
| 0 | MERGE STATEMENT | | 0 |00:00:04.33 |
| 1 | MERGE | CO_S_ORDER_TEST | 0 |00:00:04.33 |
| 2 | VIEW | | 3799 |00:00:04.29 |
| 3 | SEQUENCE | SEQ_CO_S_ORDER | 3799 |00:00:04.29 |
| 4 | PX COORDINATOR | | 3799 |00:00:04.28 |
| 5 | PX SEND QC (RANDOM) | :TQ10005 | 0 |00:00:00.01 |
|* 6 | HASH JOIN OUTER BUFFERED | | 3799 |00:00:11.51 |
| 7 | PX RECEIVE | | 3799 |00:00:00.01 |
...
| 15 | PX RECEIVE | | 4654 |00:00:00.04 |
| 16 | PX SEND HASH | :TQ10001 | 0 |00:00:00.01 |
| 17 | HASH GROUP BY | | 4654 |00:00:03.41 |
| 18 | VIEW | | 4801 |00:00:00.77 |
| 19 | UNION-ALL | | 4801 |00:00:00.77 |
| 20 | PX BLOCK ITERATOR | | 3120 |00:00:00.01 |
|* 21 | TABLE ACCESS FULL | STG_S_ORDER_DELTA | 3120 |00:00:00.01 |
|* 22 | HASH JOIN RIGHT SEMI | | 1681 |00:00:04.41 |
| 23 | PX RECEIVE | | 12480 |00:00:00.02 |
| 24 | PX SEND BROADCAST | :TQ10000 | 0 |00:00:00.01 |
| 25 | PX BLOCK ITERATOR | | 3120 |00:00:00.01 |
|* 26 | TABLE ACCESS FULL| STG_S_ORDER_DELTA | 3120 |00:00:00.01 |
| 27 | PX BLOCK ITERATOR | | 3710K|00:00:03.26 |
|* 28 | TABLE ACCESS FULL | CO_S_ORDER_TEST | 3710K|00:00:02.92 |
| 29 | PX RECEIVE | | 6107K|00:00:11.11 |
| 30 | PX SEND HASH | :TQ10004 | 0 |00:00:00.01 |
| 31 | PX BLOCK ITERATOR | | 6107K|00:00:05.37 |
|* 32 | TABLE ACCESS FULL | CO_S_ORDER_TEST | 6107K|00:00:04.69 |
--------------------------------------------------------------------------------------------
Legacy New
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders23 29.11.2018
Source
Older
Versions
Current
Versions
Core
Current
Versions
Dim
JOIN
may be
slow
Filter
may be
slow
Partitio-
ning?
Target
Loading Dimensions from Core
Current
Versions
Core
Current
Versions
Dim
Group By
may be
slow
UNION ALL
Older
Versions
Legacy New
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders24 29.11.2018
Source is a View
Older
Versions
Current
VersionsJOIN
may be
slow
Filter
may be
slow
Partitio-
ning?
Target
Loading Dimensions from Core
Full Data
Current
Versions
Group By
may be
slow
UNION ALL
Use Cases and Performance
Trivadis DOAG17: SCD2 mal anders25 29.11.2018
Loading of a dimension via view
The view joins some „big“ tables (50 Gb, 40+ Mio rows)
And produces < 500 dimension records per day
The loading time could be reduced by 45 percent (3 min 50 sec → 2 min)
Conclusion
Trivadis DOAG17: SCD2 mal anders26 29.11.2018
It is simpler and faster in certain cases
The source is queried only once, can be significant if the source is a view
The code can be simply generated
Simple to build even without generation (only a plain list of columns to Copy&Paste)
It‘s worth to do an ad hoc testing with your data
Test it!
Andrej Pashchenko
Senior Consultant
Tel. +49 211 58 666 470
andrej.pashchenko@trivadis.com
29.11.2018 Trivadis DOAG17: SCD2 mal anders28
blog.sqlora.com
Trivadis @ DOAG 2017
#opencompany
Stand: 3ter Stock, direkt an der Rolltreppe
Wir teilen unser Know how!
Einfach vorbei kommen, Live-Präsentationen
und Dokumentenarchiv
T-Shirts, Gewinnspiel und mehr
Wir freuen uns wenn Sie vorbei schauen
29.11.2018 Trivadis DOAG17: SCD2 mal anders29

More Related Content

Similar to An unconventional approach for ETL of historized data

Indexes From the Concept to Internals
Indexes From the Concept to InternalsIndexes From the Concept to Internals
Indexes From the Concept to InternalsDeiby Gómez
 
unit-6_combinational_jbiunkjnjbkjbjjcircuit-2.ppt
unit-6_combinational_jbiunkjnjbkjbjjcircuit-2.pptunit-6_combinational_jbiunkjnjbkjbjjcircuit-2.ppt
unit-6_combinational_jbiunkjnjbkjbjjcircuit-2.pptJ. Glory Precious
 
Generating lisp program for assembly drawing in AutoCAD
Generating lisp program for assembly drawing in AutoCAD Generating lisp program for assembly drawing in AutoCAD
Generating lisp program for assembly drawing in AutoCAD ISAAC SAMUEL RAJA T
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...shenjiao97221
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...xie25190
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...bcakvdrx0
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...jiduanbu
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...iphg8793466
 
Z390 Designare REV1.0.pdf
Z390 Designare REV1.0.pdfZ390 Designare REV1.0.pdf
Z390 Designare REV1.0.pdfQuangSngBi
 
Make your data dance: PIVOT and GROUP BY in Oracle SQL
Make your data dance: PIVOT and GROUP BY in Oracle SQLMake your data dance: PIVOT and GROUP BY in Oracle SQL
Make your data dance: PIVOT and GROUP BY in Oracle SQLstewashton
 
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...fijsekkdmdm2w
 
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...zan2736ban
 
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...fusjekkdmdmd2w
 
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...fusjekkdmdmd2w
 
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...f8usejkddmmd
 
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...f8usejkddmmd
 
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...ufjksemd8ujd
 
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...ufjksemd8ujd
 

Similar to An unconventional approach for ETL of historized data (20)

Indexes From the Concept to Internals
Indexes From the Concept to InternalsIndexes From the Concept to Internals
Indexes From the Concept to Internals
 
unit-6_combinational_jbiunkjnjbkjbjjcircuit-2.ppt
unit-6_combinational_jbiunkjnjbkjbjjcircuit-2.pptunit-6_combinational_jbiunkjnjbkjbjjcircuit-2.ppt
unit-6_combinational_jbiunkjnjbkjbjjcircuit-2.ppt
 
Generating lisp program for assembly drawing in AutoCAD
Generating lisp program for assembly drawing in AutoCAD Generating lisp program for assembly drawing in AutoCAD
Generating lisp program for assembly drawing in AutoCAD
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
 
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
Caterpillar Cat 320D2L Excavator (Prefix XCC) Service Repair Manual (XCC00001...
 
Z390 Designare REV1.0.pdf
Z390 Designare REV1.0.pdfZ390 Designare REV1.0.pdf
Z390 Designare REV1.0.pdf
 
Subquery factoring for FTS
Subquery factoring for FTSSubquery factoring for FTS
Subquery factoring for FTS
 
Make your data dance: PIVOT and GROUP BY in Oracle SQL
Make your data dance: PIVOT and GROUP BY in Oracle SQLMake your data dance: PIVOT and GROUP BY in Oracle SQL
Make your data dance: PIVOT and GROUP BY in Oracle SQL
 
Sch 28303 b
Sch 28303 bSch 28303 b
Sch 28303 b
 
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
 
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
Caterpillar Cat 312D and 312D L Excavator (Prefix RKF) Service Repair Manual ...
 
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
 
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
 
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
 
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
 
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
Caterpillar Cat 312D Excavator (Prefix RKF) Service Repair Manual (RKF00001 a...
 
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
Caterpillar Cat 312D L Excavator (Prefix RKF) Service Repair Manual (RKF00001...
 

More from Andrej Pashchenko

MERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsMERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsAndrej Pashchenko
 
SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?Andrej Pashchenko
 
Polymorphic Table Functions in 18c
Polymorphic Table Functions in 18cPolymorphic Table Functions in 18c
Polymorphic Table Functions in 18cAndrej Pashchenko
 
Properly Use Parallel DML for ETL
Properly Use Parallel DML for ETLProperly Use Parallel DML for ETL
Properly Use Parallel DML for ETLAndrej Pashchenko
 
Polymorphic Table Functions in 18c
Polymorphic Table Functions in 18cPolymorphic Table Functions in 18c
Polymorphic Table Functions in 18cAndrej Pashchenko
 
Online Statistics Gathering for ETL
Online Statistics Gathering for ETLOnline Statistics Gathering for ETL
Online Statistics Gathering for ETLAndrej Pashchenko
 
SQL Pattern Matching – should I start using it?
SQL Pattern Matching – should I start using it?SQL Pattern Matching – should I start using it?
SQL Pattern Matching – should I start using it?Andrej Pashchenko
 
Pure SQL for batch processing
Pure SQL for batch processingPure SQL for batch processing
Pure SQL for batch processingAndrej Pashchenko
 

More from Andrej Pashchenko (8)

MERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsMERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known Facets
 
SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?SQL Macros - Game Changing Feature for SQL Developers?
SQL Macros - Game Changing Feature for SQL Developers?
 
Polymorphic Table Functions in 18c
Polymorphic Table Functions in 18cPolymorphic Table Functions in 18c
Polymorphic Table Functions in 18c
 
Properly Use Parallel DML for ETL
Properly Use Parallel DML for ETLProperly Use Parallel DML for ETL
Properly Use Parallel DML for ETL
 
Polymorphic Table Functions in 18c
Polymorphic Table Functions in 18cPolymorphic Table Functions in 18c
Polymorphic Table Functions in 18c
 
Online Statistics Gathering for ETL
Online Statistics Gathering for ETLOnline Statistics Gathering for ETL
Online Statistics Gathering for ETL
 
SQL Pattern Matching – should I start using it?
SQL Pattern Matching – should I start using it?SQL Pattern Matching – should I start using it?
SQL Pattern Matching – should I start using it?
 
Pure SQL for batch processing
Pure SQL for batch processingPure SQL for batch processing
Pure SQL for batch processing
 

Recently uploaded

Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理e4aez8ss
 
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...ssuserf63bd7
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Seán Kennedy
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
LLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGILLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGIThomas Poetter
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectBoston Institute of Analytics
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesTimothy Spann
 
FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024
FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024
FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024Susanna-Assunta Sansone
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Boston Institute of Analytics
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...
毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...
毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...ttt fff
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...Boston Institute of Analytics
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
Real-Time AI Streaming - AI Max Princeton
Real-Time AI  Streaming - AI Max PrincetonReal-Time AI  Streaming - AI Max Princeton
Real-Time AI Streaming - AI Max PrincetonTimothy Spann
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 

Recently uploaded (20)

Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
 
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
Statistics, Data Analysis, and Decision Modeling, 5th edition by James R. Eva...
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
LLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGILLMs, LMMs, their Improvement Suggestions and the Path towards AGI
LLMs, LMMs, their Improvement Suggestions and the Path towards AGI
 
Heart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis ProjectHeart Disease Classification Report: A Data Analysis Project
Heart Disease Classification Report: A Data Analysis Project
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
 
FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024
FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024
FAIR, FAIRsharing, FAIR Cookbook and ELIXIR - Sansone SA - Boston 2024
 
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
Decoding the Heart: Student Presentation on Heart Attack Prediction with Data...
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...
毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...
毕业文凭制作#回国入职#diploma#degree美国加州州立大学北岭分校毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#de...
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
Real-Time AI Streaming - AI Max Princeton
Real-Time AI  Streaming - AI Max PrincetonReal-Time AI  Streaming - AI Max Princeton
Real-Time AI Streaming - AI Max Princeton
 
How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 

An unconventional approach for ETL of historized data

  • 1. SCD2 mal anders Andrej Pashchenko Senior Consultant, Düsseldorf @Andrej_SQL doag2017
  • 2. Unser Unternehmen. Trivadis DOAG17: SCD2 mal anders2 29.11.2018 Trivadis ist führend bei der IT-Beratung, der Systemintegration, dem Solution Engineering und der Erbringung von IT-Services mit Fokussierung auf - und -Technologien in der Schweiz, Deutschland, Österreich und Dänemark. Trivadis erbringt ihre Leistungen aus den strategischen Geschäftsfeldern: Trivadis Services übernimmt den korrespondierenden Betrieb Ihrer IT Systeme. B E T R I E B
  • 3. KOPENHAGEN MÜNCHEN LAUSANNE BERN ZÜRICH BRUGG GENF HAMBURG DÜSSELDORF FRANKFURT STUTTGART FREIBURG BASEL WIEN Mit über 600 IT- und Fachexperten bei Ihnen vor Ort. Trivadis DOAG17: SCD2 mal anders3 29.11.2018 14 Trivadis Niederlassungen mit über 600 Mitarbeitenden. Über 200 Service Level Agreements. Mehr als 4'000 Trainingsteilnehmer. Forschungs- und Entwicklungsbudget: CHF 5.0 Mio. / EUR 4.0 Mio. Finanziell unabhängig und nachhaltig profitabel. Erfahrung aus mehr als 1'900 Projekten pro Jahr bei über 800 Kunden.
  • 4. Über mich Trivadis DOAG17: SCD2 mal anders4 29.11.2018 Senior Consultant bei der Trivadis GmbH, Düsseldorf Schwerpunkt Oracle – Data Warehousing – Application Development – Application Performance Kurs-Referent „Oracle 12c New Features für Entwickler“ und „TechnoCircle Oracle 12c Release 2“ Blog: http://blog.sqlora.com
  • 5. Agenda Trivadis DOAG17: SCD2 mal anders5 29.11.2018 1. Introduction and state of the art 2. The „new“ approach 3. Use cases and performance 4. Conclusion
  • 6. Trivadis DOAG17: SCD2 mal anders6 29.11.2018 Introduction and state of the art
  • 7. Introduction Trivadis DOAG17: SCD2 mal anders7 29.11.2018 Historization? As a part of loading process in a data warehouse We consider Slowly Changing Dimensions Type II All changes are completely tracked. The change in at least one of the tracked columns toggles the creation of the new version record The most challenging task is the change detection DWH_KEY VALID_FROM VALID_TO CUR_VERSION ETL_OP BUS_KEY FIRST_NAME SECOND_NAMES LAST_NAME HIRE_DATE FIRE_DATE SALARY 1 01.12.2016 02.12.2016 N UPD 123 Roger Federer 01.01.2010 900000 11 03.12.2016 Y INS 123 Roger Federer 01.01.2010 920000 6 02.12.2016 02.12.2016 N UPD 345 Venus Williams 01.11.2016 500000 10 03.12.2016 Y INS 345 Venus Williams 01.11.2016 01.12.2016 500000 2 01.12.2016 02.12.2016 N UPD 456 Rafael Nadal 01.05.2009 720000 3 01.12.2016 01.12.2016 N UPD 789 Serena Williams 01.06.2008 650000 5 02.12.2016 Y INS 789 Serena Jameka Williams 01.06.2008 650000
  • 8. State of the Art Trivadis DOAG17: SCD2 mal anders8 29.11.2018 Typical OWB mapping
  • 9. BK_T C1_T C2_T 11 A BB 22 D E 77 M N 33 F G State of the Art Trivadis DOAG17: SCD2 mal anders9 29.11.2018 BK C1 C2 11 A B 22 D E 44 K L 77 M BK C1 C2 11 A BB 22 D E 33 F G 77 M N BK_S C1_S C2_S 11 A B 22 D E 44 K L 77 M NVL(C2_S,'(NULL)') != NVL(C2_T,'(NULL)') LNNVL(C2_S = C2_T) AND NVL(C2_S, C2_T) IS NOT NULL DECODE, STANDARD_HASH, SYS_OP_MAP_NONNULL … Full Outer Join Change Detection? Old Versions New Versions Old New Target Source Target Split UNION ALL MERGE More on delta detection: https://danischnider.wordpress.com/2016/10/08/delta-detection-in-oracle-sql/ Data to the left has to be accessed twice!
  • 10. State of the Art Trivadis DOAG17: SCD2 mal anders10 29.11.2018 Change detection must be done with respect to null values Comparing each and every column in a complex way Or maintaining and comparing hash-diffs: common rules needed, re-hashing after structural changes sometimes needed Full outer join may be expensive if not working with „deltas“ Splitting the join result into two data sets causes this join to be made twice Another solution?
  • 11. Trivadis DOAG17: SCD2 mal anders11 29.11.2018 The „new“ approach
  • 12. The „new“ approach Trivadis DOAG17: SCD2 mal anders12 29.11.2018 The „new“ approach is not really new Oft used for ad hoc queries Are these two records different? Using Group BY BK C1 C2 C3 C4 … … C467 C468 C469 11 A B C D … … AA BB CC 11 A B C D … … AB BB CC SELECT COUNT(*) FROM t GROUP BY BK, C1, C2, C3, C4, … C467, C468, C469
  • 13. The „new“ approach Trivadis DOAG17: SCD2 mal anders13 29.11.2018 Or using analytical function: If count equals 2 – they are the same If count equals 1 – they are different For GROUP BY and PARTITION BY: NULL=NULL, VALUE!=NULL SELECT COUNT(*) OVER (PARTITION BY BK, C1, C2, C3, … C468, C469) FROM t; But what about NULLs?
  • 14. BK C1 C2 11 A BB 33 F G 77 M N S_T BK C1 C2 T 11 A BB T 22 D E T 33 F G T 77 M N The „new“ approach Trivadis DOAG17: SCD2 mal anders14 29.11.2018 BK C1 C2 11 A B 22 D E 44 K L 77 M BK C1 C2 11 A BB 22 D E 33 F G 77 M N UNION ALL Target Source Target GROUP BY MERGE S_T BK C1 C2 S 11 A B S 22 D E S 44 K L S 77 M MIN (S_T) S S S S T T T DEMO! BK C1 C2 11 A B 22 D E 44 K L 77 M CNT 1 2 1 1 1 1 1
  • 15. The „new“ approach Trivadis DOAG17: SCD2 mal anders15 29.11.2018
  • 16. An unconventional approach for ETL of historized data16 19.03.2017 Use Cases and Performance
  • 17. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders17 29.11.2018 Source Older Versions Full Data Current VersionsJOIN may be slow Filter may be slow Partitio- ning? Target Full Data Load Full Data Current Versions Group By may be slow UNION ALLLegacy New
  • 18. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders18 29.11.2018 Source Delta JOIN Filter may be slow Partitio- ning? Older Versions Current Versions Target Delta Load Delta Current Versions Group By may be slow UNION ALLLegacy New
  • 19. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders19 29.11.2018 Source Older Versions Delta Current Versions JOIN Filter Business_key IN … Target Delta Load with pre-filter Delta Current Ver- sions (filtered) Group By fast UNION ALLLegacy New
  • 20. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders20 29.11.2018 Data Warehouse with Siebel-CRM as a source Order table S_ORDER – 120 columns „only“ Comparing legacy approach vs. GROUP BY vs. analytical functions Full staging table as a source vs. delta (with or without pre-filtering) Ca. 6 Mio rows in the target table Ca. 3 Mio rows in the full load dataset Ca. 3000 rows in the delta load dataset
  • 21. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders21 29.11.2018 Method Delta Load, min Full Load, min Outer Join (legacy approach) 0:09 0:41 GROUP BY 1:10 1:04 GROUP BY with pre-filter 0:04 N/A Analytic Function 2:12 4:52 Analytic with pre-filter 0:12 N/A
  • 22. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders22 29.11.2018 Execution Plan -------------------------------------------------------------------------------------------- | Id | Operation | Name | A-Rows | A-Time | -------------------------------------------------------------------------------------------- | 0 | MERGE STATEMENT | | 0 |00:00:04.33 | | 1 | MERGE | CO_S_ORDER_TEST | 0 |00:00:04.33 | | 2 | VIEW | | 3799 |00:00:04.29 | | 3 | SEQUENCE | SEQ_CO_S_ORDER | 3799 |00:00:04.29 | | 4 | PX COORDINATOR | | 3799 |00:00:04.28 | | 5 | PX SEND QC (RANDOM) | :TQ10005 | 0 |00:00:00.01 | |* 6 | HASH JOIN OUTER BUFFERED | | 3799 |00:00:11.51 | | 7 | PX RECEIVE | | 3799 |00:00:00.01 | ... | 15 | PX RECEIVE | | 4654 |00:00:00.04 | | 16 | PX SEND HASH | :TQ10001 | 0 |00:00:00.01 | | 17 | HASH GROUP BY | | 4654 |00:00:03.41 | | 18 | VIEW | | 4801 |00:00:00.77 | | 19 | UNION-ALL | | 4801 |00:00:00.77 | | 20 | PX BLOCK ITERATOR | | 3120 |00:00:00.01 | |* 21 | TABLE ACCESS FULL | STG_S_ORDER_DELTA | 3120 |00:00:00.01 | |* 22 | HASH JOIN RIGHT SEMI | | 1681 |00:00:04.41 | | 23 | PX RECEIVE | | 12480 |00:00:00.02 | | 24 | PX SEND BROADCAST | :TQ10000 | 0 |00:00:00.01 | | 25 | PX BLOCK ITERATOR | | 3120 |00:00:00.01 | |* 26 | TABLE ACCESS FULL| STG_S_ORDER_DELTA | 3120 |00:00:00.01 | | 27 | PX BLOCK ITERATOR | | 3710K|00:00:03.26 | |* 28 | TABLE ACCESS FULL | CO_S_ORDER_TEST | 3710K|00:00:02.92 | | 29 | PX RECEIVE | | 6107K|00:00:11.11 | | 30 | PX SEND HASH | :TQ10004 | 0 |00:00:00.01 | | 31 | PX BLOCK ITERATOR | | 6107K|00:00:05.37 | |* 32 | TABLE ACCESS FULL | CO_S_ORDER_TEST | 6107K|00:00:04.69 | --------------------------------------------------------------------------------------------
  • 23. Legacy New Use Cases and Performance Trivadis DOAG17: SCD2 mal anders23 29.11.2018 Source Older Versions Current Versions Core Current Versions Dim JOIN may be slow Filter may be slow Partitio- ning? Target Loading Dimensions from Core Current Versions Core Current Versions Dim Group By may be slow UNION ALL Older Versions
  • 24. Legacy New Use Cases and Performance Trivadis DOAG17: SCD2 mal anders24 29.11.2018 Source is a View Older Versions Current VersionsJOIN may be slow Filter may be slow Partitio- ning? Target Loading Dimensions from Core Full Data Current Versions Group By may be slow UNION ALL
  • 25. Use Cases and Performance Trivadis DOAG17: SCD2 mal anders25 29.11.2018 Loading of a dimension via view The view joins some „big“ tables (50 Gb, 40+ Mio rows) And produces < 500 dimension records per day The loading time could be reduced by 45 percent (3 min 50 sec → 2 min)
  • 26. Conclusion Trivadis DOAG17: SCD2 mal anders26 29.11.2018 It is simpler and faster in certain cases The source is queried only once, can be significant if the source is a view The code can be simply generated Simple to build even without generation (only a plain list of columns to Copy&Paste) It‘s worth to do an ad hoc testing with your data Test it!
  • 27. Andrej Pashchenko Senior Consultant Tel. +49 211 58 666 470 andrej.pashchenko@trivadis.com 29.11.2018 Trivadis DOAG17: SCD2 mal anders28 blog.sqlora.com
  • 28. Trivadis @ DOAG 2017 #opencompany Stand: 3ter Stock, direkt an der Rolltreppe Wir teilen unser Know how! Einfach vorbei kommen, Live-Präsentationen und Dokumentenarchiv T-Shirts, Gewinnspiel und mehr Wir freuen uns wenn Sie vorbei schauen 29.11.2018 Trivadis DOAG17: SCD2 mal anders29