+ All Categories
Home > Documents > CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

Date post: 06-Jul-2018
Category:
Upload: sbabuind
View: 228 times
Download: 0 times
Share this document with a friend
18
Tur b o ch arge S Q LPerf o r m an ce with O racle Datab ase 12c P h i l ip M o o r e S e ni or Dat a A r ch i t ec t and D eve l o pe r
Transcript
Page 1: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 1/18

Turbocharge SQL Performance withOracle Database 12c

Philip Moore

Senior Data Architect and Developer

Page 2: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 2/18

222

 © 84.51° 2015 | Public

We believe in making people’s lives easierby putting the customer at the center of everything we do

WHO IS 84.51°

Page 3: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 3/18

333

 © 84.51° 2015 | Public

84.51° HELPS COMPANIES PUT THE CUSTOMER AT THE CENTER OF EVERY DECISION

With insights from the data, we personalize

the experience, making your business more

relevant to consumers who matter most

Second, we work with you to change the

organization, embedding the principle of

shopper first

In so doing, we grow measurable brand

value for our clients

Page 4: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 4/18

444

 © 84.51° 2015 | Public

0%

-1%-2%

-1%-1%

0%

1%

1%

1%

2% 2%

2%

3%4%

5%

6%6%

5%5% 5% 5%

6%5%

6%

5%

6%

4%

3%3%

1% 1%

2%3%

2%

4%

5%

5%5% 5%

4%

4%3%

4%

Identical Store Sales !"c #uel$

% &an'e in Identical Store Sales (ear on (ear 

PLACING THE CUSTOMER AT THE CENTER WORKS

JV artnership

began in !""#

$"%

"%

Page 5: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 5/18

555

© 84.51° 2015 | Public 5

WHO AM I?

P&ili) *oore

& Exadata Data Warehouse Architect / Lead Oracle

Developer – 84.51°

& 15+years Oracle data warehousing (since Oracle 8i)

& 5+years with Oracle Exadata (v2, x2, x3)

& Oracle Certified Professional

‑ PL/SQL Developer

‑ 10g DBA

& Oracle SQL Certified Expert

?

Experience with:

& SQL Server

& Teradata

& Netezza

& Greenplum

& PostgreSQL

Page 6: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 6/18

666

Before we start on 12c…

Let’s Talk about:

84.51’s Oracle Data Warehouse

Page 7: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 7/18

+++© 84.51° 2015 | Public +

& '()&  *nalyst ad+hoc ueries -no+S)*.& )oyalty /ampaign 0ailer 

& '()& roducts 11 (he Shop& re+canned ueries with S)*

2racle 'xadata runs the heart of our 3ata Warehouse4 It has enabled us to

deliver things we could not do before4

We use an *ctive+*ctive 3isaster 5ecovery configuration 11 using a dual '()6')(

strategy to load data into our rimary site and to the 365 and roducts site

Pri,ar Site / and Products Site

W' 7S' 25*/)' '8*3*(*

ETL ETL

Page 8: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 8/18

888© 84.51° 2015 | Public 8

#act able

200 illion

ros

)ogically 9 We use a traditional:imball star schema

!"a,)le client ,odel

/ustomers

300 *illion ros

(erminals

500 ros

Stores

15000 ros

3ates

4+00 ros

roducts

8 *illion ros

84.51 - ata 7are&ouse Point o Sale ata *odel

Page 9: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 9/18

999© 84.51° 2015 | Public 9

hysically 9 we use the following strategies

#or i,ensions

& 2racle *dvanced /ompression

-/205'SS ;25 2)(.

& rimary :eys are enforced 9 in

5')< mode

& 2racle 3I0'=SI2= ob>ects

& 'xadata ?ybrid /olumnar /ompression

-?//. 9 @7'5< ?IA?

& We will put the latest ! years -B?otC

data. into the In+0emory /olumn Store

& artition by 5*=A' on our date field, $

week per partition

:Sot; eerential Inte'rit or

#orei'n <e relations&i)s

& =70D'5 for =umbers

& 3*(' for 3ates

& V*5/?*5! for /haracters

#or #acts

Pro)er data t)es or our data

=> =?@@ and A!< constraints

to Balidate data and &el) >

?<SI/*) 023') S(5*('AI'S ;25 '8*3*(*

Page 10: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 10/18

101010

Now Let’s Talk Oracle 12c New Featuresthat will speed up the Data Warehouse

Page 11: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 11/18

111111© 84.51° 2015 | Confidential

12c – New Data Warehousing FeaturesThese new features will accelerate your Data Warehouse SQL queries

Oracle In-Memory ColumnStore

In-Memory Aggregation(Vector Group By)

Attribute Clustering

Adaptive Optimization

Approximate Aggregation

Page 12: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 12/18

121212© 84.51° 2015 | Public 12

Query plans are not longer set in stone!

Before 12c – the Optimizer’s decision was locked – meaning that no matter howbad its cardinality estimates were for each phase of execution – it continued downthe ill-advised path.

The Optimizer can now change path in mid-query execution – for:

o Join Paths

 1 Helps recover from stale stats causing nested loop joins with large driving tables forexample.

o Parallel Query Distribution Methods (Broadcast / Hash)

 1 This helps your query recover from high skew – preventing an unbalanced

This feature will take queries than run in hours in 11gR2 run in minutes or less!

ADAPTIVE OPTIMIZATIONThe Cost-Based Optimizer just got a whole lot smarter!

adaptive_join.html

Page 13: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 13/18

131313© 84.51° 2015 | Public 13

Data is organized in columnar, compressed format

Ideal for Data Warehousing (Decision Support Systems) – with analytical workloads

Oracle In-Memory excels at:

o Predicate Filtering (due to SIMD instructions and IMCU “pruning”)

o Bloom Filters for large joins

o Full Table Scans

o Additive Aggregation (hopefully non-additive as well soon)

You will typically see 10-50x performance improvement for non-Exadata, and about5-10x with Exadata. Note: with Exadata – In-Memory doesn’t shine until you have ahighly concurrent workload…

With Engineered Systems – you can choose how the data is spread across RACNodes:

o Distribution (default) – (best for fact tables)

o Duplication – consider this for Dimension tables

ORACLE IN-MEMORY COLUMN STORERevolutionizing Analytical Query Performance

Page 14: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 14/18

141414© 84.51° 2015 | Public 14

Also known as “I.M.A.” – or “Vector Group By”

The methodology was taken from Oracle OLAP – and fitted into In-Memory withuse by SQL for the first time

The data is aggregated as it is scanned – reducing TEMP usage to zero in mostcases – allowing for blazing fast aggregation for additive measures.

The decision is Cost-Based – and by default only kicks in if your fact table has 10million or more rows.

You can force Vector Group By in your star aggregation query by using the “/*+vector_transform */” hint

We have seen 16x performance improvement with Vector Group By as compared tothe “traditional” Hash Group By aggregation method.

IN-MEMORY AGGREGATION A Smarter way to Aggregate

no_vector_group_by.html vector_group_by.html

Page 15: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 15/18

151515© 84.51° 2015 | Public 15

For the first time – the way data is stored and sorted in a table (or partition) isdeclarative

Any direct-path INSERTs or “ALTER TABLE … MOVE” commands which load orreorganize the table will obey the table-level attribute clustering directives (stored inthe data dictionary)

Storing data that logically belongs together helps improve performance, compression

ratios, and improved concurrency for users of your system You can use “Join Attribute Clustering” to organize your fact data by dimensionalattributes. This can greatly speed up star queries.

You can choose between two options:

o Linear (basic ORDER BY) – allowing for better compression – benefitting In-Memory as wellas Oracle Exadata Hybrid Columnar Compression

o

Interleaved – a.k.a “Z-Order Curve Fitting” – ideal for hierarchical aggregation via star queries Can be combined with Zone Maps (on Exadata) – to facilitate zone pruning anddramatically reduce I/O as a result

ATTRIBUTE CLUSTERINGStoring similar “fact” rows together

Page 16: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 16/18

161616© 84.51° 2015 | Public 16

ATTRIBUTE CLUSTERINGExample – from Oracle 12c Data Warehousing Guide documentation

& For Linear-Ordered tables – thedata is simply sorted in the orderof the column(s) you specify

& For Interleaved-Ordered tables –the data is arranged so that the

data is contiguous in a multi-dimensional manner – meaningthat contiguous regions containdata for similar “Country” and“Category” values

Page 17: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 17/18

1+1+1+© 84.51° 2015 | Public 1+

This technique helps solve the difficult: “Count Distinct Problem” – see:https://

en.wikipedia.org/wiki/Count-distinct_problem

HyperLogLog provides about 97%+ accuracy while using far fewer resources thantraditional “COUNT (DISTINCT expr)” aggregation

HyperLogLog is distributable – meaning that it can be merged between parallel slaves –

effectively making Distinct Counts “additive” in nature.

APPROX_COUNT_DISTINCT provides nearly 10x query performance improvement

when used for star queries which perform Distinct Counts with hierarchical aggregation

The more Distinct Counts you do in your query – the more it shines

This feature is near and dear to my heart – after learning about HyperLogLog – Irequested (via an SR enhancement request via “My Oracle Support”) that Oracle adopt

the “APPROX_COUNT_DISTINCT” function based upon Flajolet’s algorithm.

Oracle put the customer first and graciously added this revolutionary new feature

Many more approximate features could (will) be coming to an Oracle release near you!

APPROXIMATE AGGREGATIONUsing the brilliant: HyperLogLog algorithm

exa_approx_count_distinct.html exa_exact_count_distinct.html

Page 18: CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

8/17/2019 CON6182_Moore-CON6182 - Turbocharge SQL Performance Using Oracle Database 12c

http://slidepdf.com/reader/full/con6182moore-con6182-turbocharge-sql-performance-using-oracle-database-12c 18/18

181818

THANKYOU!


Recommended