Professional Documents
Culture Documents
Best Practices For Exadata and Optimizer
Best Practices For Exadata and Optimizer
Best Practices For Exadata and Optimizer
Oracle Optimizer
Maria Colgan, Product Manager, Oracle Optimizer
Levi Norman, Product Marketing Director, Oracle Exadata
1
10X
Up to
50X
+
Hybrid Columnar Compression
Smart Flash
Cache
Agenda
NO_INVALIDATE
CONCURRENT
GRANULARITY
DEGREE
PUBLISH
ESTIMATE_PERCENT
INCREMENTAL
METHOD_OPT
STALE_PERCENT
AUTOSTATS_TARGET
(SET_GLOBAL_PREFS only)
10
11
AUTO_SAMPLE_SIZE
10% SAMPLE
100% SAMPLE
00:02:21.86
00:02:31.56
00:08:24.10
00:02:38.11
00:02:49.49
00:07:38.25
00:02:39.31
00:02:38.55
00:07:37.83
12
Column
Name
NDV with
AUTO_SAMPLE_SIZE
NDV with
10%
SAMPLE
C1
59852
31464
60351
C2
1270912
608544
1289760
C3
768384
359424
777942
Agenda
13
Expression statistics
Expression statistics useful when a column is used as part of a
complex expression in where clause predicate
Extended Statistics
Column Group Statistics
SELECT * FROM vehicles
WHERE model = 530xi
AND
color = 'RED;
MAKE
MODEL
COLOR
BMW
530xi
RED
Cardinality= #ROWS * 1
* 1
=> 12 * 1 * 1 = 1
NDV c1 NDV c2
4 3
15
Vehicles Table
Make
Model
Color
BMW
BMW
BMW
PORSCHE
MERC
MERC
RED
BLACK
SILVER
RED
RED
SLIVER
530xi
530xi
530xi
911
SLK
C320
Extended Statistics
Column Group Statistics
SELECT * FROM vehicles WHERE model = 530xi
make = BMW;
AND
MAKE
MODEL
COLOR
BMW
530xi
RED
BMW
530xi
BLACK
BMW
530xi
SLIVER
Cardinality= #ROWS * 1
* 1
=> 12 * 1 * 1 = 1
NDV c1 NDV c2
4 3
16
Vehicles Table
Make
Model
Color
BMW
BMW
BMW
PORSCHE
MERC
MERC
RED
BLACK
SILVER
RED
RED
SLIVER
530xi
530xi
530xi
911
SLK
C320
Extended Statistics
Column Group Statistics
Create extended statistics on the Model & Make columns using
DBMS_STATS.CREATE_EXTENDED_STATS
New Column
with system
generated
name
17
Extended Statistics
Column Group Statistics
SELECT * FROM vehicles WHERE model = 530xi
make = BMW;
AND
MAKE
MODEL
COLOR
BMW
530xi
RED
BMW
530xi
BLACK
BMW
530xi
SLIVER
18
Vehicles Table
Make
Model
Color
BMW
BMW
BMW
PORSCHE
MERC
MERC
RED
BLACK
SILVER
RED
RED
SLIVER
530xi
530xi
530xi
911
SLK
C320
Extended Statistics
Expression Statistics
SELECT *
FROM Customers
WHERE UPPER(CUST_LAST_NAME) = SMITH;
COUNT(*)
55500
19
Cardinality estimate
is 1% of the rows
Extended Statistics
Expression Statistics
20
Extended Statistics
Automatic Column Group Detection
1. Start column group usage capture
21
Extended Statistics
Automatic Column Group Detection
2. Run your workload
22
Extended Statistics
Automatic Column Group Detection
2. Run your workload
23
Extended Statistics
Automatic Column Group Detection
3. Check column usage information recorded for our table
SELECT dbms_stats.report_col_usage(user, 'customers') FROM dual;
Statistics Enhancements
Automatic Column Group Detection
4. Create extended stats for customers based on usage
SELECT dbms_stats.create_extended_stats(user, 'customers')
FROM dual;
EXTENSIONS FOR SH.CUSTOMERS
1. (CUST_CITY, CUST_STATE_PROVINCE, COUNTRY_ID):
SYS_STUMZ$C3AIHLPBROI#SKA58H_N
created
2. (CUST_STATE_PROVINCE, COUNTRY_ID) :
SYS_STU#S#WF25Z#QAHIHE#MOFFMM_
created
Agenda
26
28
29
:
Partition 4
June 4th 2012
Partition 5
June 5th 2012
31
Agenda
32
33
34
P1
P2
P3
P4
35
P2
P3
P4
Partition 2
May 19th 2012
Partition 3
May 20th 2012
36
37
Job1
Partition 2
May 19th 2012
Job2
Partition 3
May 20th 2012
39
Job3
Sysaux Tablespace
41
42
More Information
Accompanying Two Part White Paper Series
Understanding Optimizer Statistics
Best Practices for Managing Optimizer Statistics
Optimizer Blog
http://blogs.oracle.com/optimizer
Oracle.com
http://www.oracle.com/technetwork/database/focus-areas/bidatawarehousing/dbbi-tech-info-optmztn-092214.html
43
44