© Copyright 2015. Apps Associates LLC. 1
Performance Tuning Overview
March 30, 2015
© Copyright 2015. Apps Associates LLC. 2
Indexing
© Copyright 2015. Apps Associates LLC. 3
0..50
51..100
101..150
….
10000.. 10050
0..10
11..19
20..25
….
47.. 50
51..58
59..63
64..75
….
98.. 100
10000.. 10009
10010.. 10020
10021..10028
…
10046..10050
0,rowid
0,rowid
1,rowid
….
10,rowid
11,rowid
11,rowid
12,rowid
….
19,rowid
10046,rowid
10048,rowid
10048,rowid
….
10050,rowid
….
….
10021,rowid
10022,rowid
10023,rowid
….
10028,rowid
….
Create index I on T(numColumn)
© Copyright 2015. Apps Associates LLC. 4
B*Tree When to use
• CLUSTERING FACTOR
– A measure of how sorted the table is by the key in the index
– It measures how many IO’s it would take to read the entire table via the index – row
after row after row
– If table is sorted by key, clustering factor near number of blocks in the table.
– If table is not sorted by key, clustering factor nearer number of ROWS in table.
– Please ask yourself, how many ways can the table be sorted on disk?
© Copyright 2015. Apps Associates LLC. 5
1,Alice
2,Bob
3,Candy
4,Doug
5,Ellen
6,Frank
7,George
8,Hank
….
….
….
….
….
… …
…
…
…
….
0..50
51..100
101..150
….
10000.. 100500..10
11..19
20..25
….
47.. 50
51..58
59..63
64..75
….
98.. 100
10000.. 10009
10010.. 10020
10021..10028
…
10046..10050
….
Create index nm_idx on name)
Select * from t where pk between 1 and 8
Pk Name
1 Alice
2 Sue
3 Victor
4 Will
Pk Name
5 Irene
6 Kelly
7 Melanie
8 Oliver
Pk Name
9 George
10 Candy
11 Uwe
12 Wally
Pk Name
13 Ellen
14 Tom
15 Rick
16 Paul
Pk Name
17 Doug
18 Irene
19 Lance
20 Jack
Pk Name
21 Hank
22 Frank
23 Nicole
24 Bob
© Copyright 2015. Apps Associates LLC. 6
1,Alice
2,Bob
3,Candy
4,Doug
5,Ellen
6,Frank
7,George
8,Hank
….
….
….
….
….
… …
…
…
…
….
0..50
51..100
101..150
….
10000.. 100500..10
11..19
20..25
….
47.. 50
51..58
59..63
64..75
….
98.. 100
10000.. 10009
10010.. 10020
10021..10028
…
10046..10050
….
Create index nm_idx on name)
Select * from t where Name between ‘Alice’ and ‘Hank’
Pk Name
1 Alice
2 Sue
3 Victor
4 Will
Pk Name
5 Irene
6 Kelly
7 Melanie
8 Oliver
Pk Name
9 George
10 Candy
11 Uwe
12 Wally
Pk Name
13 Ellen
14 Tom
15 Rick
16 Paul
Pk Name
17 Doug
18 Irene
19 Lance
20 Jack
Pk Name
21 Hank
22 Frank
23 Nicole
24 Bob
Access paths – Getting the data
Access Path Explanation
Full table scan Reads all rows from table & filters out those that do not meet the where clause predicates. Used when no
index, DOP set etc
Table access by Rowid Rowid specifies the datafile & data block containing the row and the location of the row in that block. Used if
rowid supplied by index or in where clause
Index unique scan Only one row will be returned. Used when stmt contains a UNIQUE or a PRIMARY KEY constraint that
guarantees that only a single row is accessed
Index range scan Accesses adjacent index entries returns ROWID values Used with equality on non-unique indexes or range
predicate on unique index (<.>, between etc)
Index skip scan Skips the leading edge of the index & uses the rest Advantageous if there are few distinct values in the leading
column and many distinct values in the non-leading column
Full index scan Processes all leaf blocks of an index, but only enough branch blocks to find 1st leaf block. Used when all
necessary columns are in index & order by clause matches index struct or if sort merge join is done
Fast full index scan Scans all blocks in index used to replace a FTS when all necessary columns are in the index. Using multi-block IO
& can going parallel
Index joins Hash join of several indexes that together contain all the table columns that are referenced in the query. Wont
eliminate a sort operation
Bitmap indexes uses a bitmap for key values and a mapping function that converts each bit position to a rowid. Can efficiently
merge indexes that correspond to several conditions in a WHERE clause
© Copyright 2015. Apps Associates LLC. 8
Reverse Key Index
• Physically stores the bytes of the keys in reverse order
• In general, typically prevents range scanning
– 5 is not stored next to 6 is not stored next to 7…
• Used to avoid “hot block syndrome”
• Can also be used to avoid having to re-organize a ‘sweeping’ index
© Copyright 2015. Apps Associates LLC. 9
Reverse Key Index - performance
• It can help with buffer busy waits
– On monotonically increasing values
– Eg: sequence populated fields
– Eg: date/timestamp fields
• Especially in a clustered environment, this can reduce latency
• At the cost of additional CPU
– Evident mostly in single user mode
– When you go multi-user, because you are not spinning on a buffer wait, you see
less overall CPU
© Copyright 2015. Apps Associates LLC. 10
Reverse Key Index - performance
• PL/SQL still more efficient
• Reverse Key index has measurable impact for PL/SQL
Single User PL/SQL Pro*C
Reverse No Reverse Reverse No Reverse
Transaction/second 38.24 43.45 17.35 19.08
CPU time (seconds) 25 22 33 31
Buffer busy waits number/time 0/0 0/0 0/0 0/0
Elapsed time (minutes) 0.42 0.37 0.92 0.83
Log file sync number/time 6/0 1,940/7 1,940/7
© Copyright 2015. Apps Associates LLC. 11
Reverse Key Index - performance
Transaction/second 46.59 49.03 20.07 20.29
CPU time (seconds) 77 73 104 101
Buffer busy waits number/time 4,267/2 133,644/2 3,286/0 23,688/1
Elapsed time (minutes) 0.68 0.65 1.58 1.57
Log file sync number/time 19/0 18/0 3,273/29 2,132/29
PL/SQL Pro*C
Reverse No Reverse Reverse No Reverse
• PL/SQL still more efficient
• Reverse Key index has measurable impact for PL/SQL in this case
Two Users
© Copyright 2015. Apps Associates LLC. 12
Reverse Key Index - performance
PL/SQL still more efficient
Reverse Key index has impressively measurable effect
As we scale up – this will have more of an impact
At low concurrency, little impact
Ten Users
PL/SQL Pro*C
Reverse No Reverse Reverse No Reverse
Transaction/second 45.90 35.38 17.88 16.05
CPU time (seconds) 781 789 1,256 1,384
Buffer busy waits number/time 26k/279 456k/1,382 25k/134 364k/1702
Elapsed time (minutes) 3.47 4.50 8.90 9.92
Log file sync number/time 2,602/72 11k/196 12k/141
What basic statistics to collect
• By default the following basic table & column statistic are collected
– Number of Rows
– Number of blocks
– Average row length
– Number of distinct values
– Number of nulls in column
What basic statistics to collect
• Index statistics are automatically gathered during creation and maintained
by GATHER_TABLE_STATS and include
– Number of leaf blocks
– Branch Levels
– Clustering factor
• 12c – Tables have basic statistics gathered
during loads into empty segments too
What basic statistics to collect
• Histograms tell Optimizer about the data distribution in a Column
• Creation controlled by METHOD_OPT parameter
• Default create histogram on any column that has been used in the WHERE
clause or GROUP BY of a statement AND has a data skew
• Relies on column usage information gathered at compilation time and
stored in SYS.COL_USAGE$
Histograms
What basic statistics to collect
• 11g and before - Two types of histograms
– Frequency
– Height-balanced
• 12c and after – two more
– Top Frequency
– Hybrid
Histograms
Histograms
• A frequency histogram is only created if the number of distinct values in a
column (NDV) is less than 254 values
Frequency histograms (FREQUENCY)
Frequency histogram
Histograms
• A height balanced histogram is created if the number of distinct values in a
column (NDV) is greater than 254 values
Height balanced histograms (HEIGHT BALANCED)
Height balanced histogram
Histograms
• Traditionally a frequency histogram is only created if NDV < 254
• But if a small number of values occupies most of the rows (>99% rows)
• Creating a frequency histograms on that small set of values is very useful even
though NDV is greater than 254
• Ignores the unpopular values to create a better quality histogram for
popular values
• Built using the same technique used for frequency histograms
• Only created with AUTO_SAMPLE_SIZE
Top Frequency (TOP-FREQUENCY) 12c
Histograms
• Similar to height balanced histogram as created if the NDV >254
• Store the actual frequencies of bucket endpoints in histograms
• No values are allowed to spill over multiple buckets
• More endpoint values can be squeezed in a histogram
• Achieves the same effect as increasing the # of buckets
• Only created with AUTO_SAMPLE_SIZE
Hybrid Histograms (HYBRID) 12c
© Copyright 2015. Apps Associates LLC. 21
Thank You!

More Related Content

PDF
Editioning use in ebs
PDF
Aioug ha day oct2015 goldengate- High Availability Day 2015
PDF
Getting optimal performance from oracle e business suite(aioug aug2015)
PDF
Ebs12.2 online patching(aioug_aug2015)
PPTX
Oracle applications r12.2, ebr, online patching means lot of work for devel...
PPT
Adop and maintenance task presentation 151015
PDF
AWR & ASH Analysis
PDF
Ebs upgrade-to-12.2 technical-upgrade_best_practices(aioug-aug2015)
Editioning use in ebs
Aioug ha day oct2015 goldengate- High Availability Day 2015
Getting optimal performance from oracle e business suite(aioug aug2015)
Ebs12.2 online patching(aioug_aug2015)
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Adop and maintenance task presentation 151015
AWR & ASH Analysis
Ebs upgrade-to-12.2 technical-upgrade_best_practices(aioug-aug2015)

What's hot (20)

PDF
Aman sharma hyd_12crac High Availability Day 2015
PDF
Getting optimal performance from oracle e-business suite presentation
PDF
Oracle IaaS Overview - AIOUG Hyderabad Chapter
PDF
Dg broker &amp; client connectivity - High Availability Day 2015
PDF
Database and application performance vivek sharma
PDF
OOW15 - Getting Optimal Performance from Oracle E-Business Suite
PDF
Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
PDF
Dmz aa aioug
DOCX
R12.2.5 new features
PPTX
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
PDF
How to Use EXAchk Effectively to Manage Exadata Environments
PPTX
Upgrading Em13c Collaborate 2016
PPTX
What’s New in Oracle E-Business Suite R12.2 for Database Administrators?
PPTX
E business suite r12.2 changes for database administrators
PDF
GLOC 2014 NEOOUG - R12 Upgrade Downtime Reduction
PDF
Oracle RAC 19c: Best Practices and Secret Internals
PDF
Preparing for EBS R12.2-upgrade-full
PDF
Oracle R12 EBS Performance Tuning
PDF
OOW15 - technical upgrade best practices for oracle e-business suite 12.2
PPTX
Oracle E-Business Suite on Kubernetes Cluster
Aman sharma hyd_12crac High Availability Day 2015
Getting optimal performance from oracle e-business suite presentation
Oracle IaaS Overview - AIOUG Hyderabad Chapter
Dg broker &amp; client connectivity - High Availability Day 2015
Database and application performance vivek sharma
OOW15 - Getting Optimal Performance from Oracle E-Business Suite
Oracle E-Business Suite R12.2.5 on Database 12c: Install, Patch and Administer
Dmz aa aioug
R12.2.5 new features
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
How to Use EXAchk Effectively to Manage Exadata Environments
Upgrading Em13c Collaborate 2016
What’s New in Oracle E-Business Suite R12.2 for Database Administrators?
E business suite r12.2 changes for database administrators
GLOC 2014 NEOOUG - R12 Upgrade Downtime Reduction
Oracle RAC 19c: Best Practices and Secret Internals
Preparing for EBS R12.2-upgrade-full
Oracle R12 EBS Performance Tuning
OOW15 - technical upgrade best practices for oracle e-business suite 12.2
Oracle E-Business Suite on Kubernetes Cluster
Ad

Viewers also liked (7)

PDF
Getting optimal performance from oracle e business suite
PDF
Ebs12.2 online patching
PDF
veshaal-singh-ebs-oracle cloud(iaas+paas)
PDF
Ebs upgrade-to-12.2 technical-upgrade_best_practices
PDF
Implementing cloud applications redefine your dimension
PDF
Leverage integration cloud_service_for_ebs_
PDF
Oracle analytics cloud overview feb 2017
Getting optimal performance from oracle e business suite
Ebs12.2 online patching
veshaal-singh-ebs-oracle cloud(iaas+paas)
Ebs upgrade-to-12.2 technical-upgrade_best_practices
Implementing cloud applications redefine your dimension
Leverage integration cloud_service_for_ebs_
Oracle analytics cloud overview feb 2017
Ad

Similar to Indexes overview (20)

PPTX
Optimizing Application Performance - 2022.pptx
PPTX
Sql 2016 - What's New
PPTX
Query Optimization in SQL Server
PPTX
Presentación Oracle Database Migración consideraciones 10g/11g/12c
PPTX
T sql performance guidelines for better db stress powers
PPTX
T sql performance guidelines for better db stress powers
PPTX
T sql performance guidelines for better db stress powers
PPTX
Data Query Using Structured Query Language - WITH NOTES.pptx
PPTX
New T-SQL Features in SQL Server 2012
PPTX
Sql and PL/SQL Best Practices I
PDF
TAU Performance tool using OpenPOWER
PDF
Exploring T-SQL Anti-Patterns
PDF
How to analyze and tune sql queries for better performance percona15
PPT
Db2 sql tuning and bmc catalog manager
PDF
Improve speed &amp; performance of informix 11.xx part 1
PDF
Sumo Logic Quick Start - Feb 2016
ODP
SQL Tunning
PPTX
Sumo Logic QuickStart Webinar July 2016
PPT
Top 10 Oracle SQL tuning tips
PDF
How to analyze and tune sql queries for better performance webinar
Optimizing Application Performance - 2022.pptx
Sql 2016 - What's New
Query Optimization in SQL Server
Presentación Oracle Database Migración consideraciones 10g/11g/12c
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
Data Query Using Structured Query Language - WITH NOTES.pptx
New T-SQL Features in SQL Server 2012
Sql and PL/SQL Best Practices I
TAU Performance tool using OpenPOWER
Exploring T-SQL Anti-Patterns
How to analyze and tune sql queries for better performance percona15
Db2 sql tuning and bmc catalog manager
Improve speed &amp; performance of informix 11.xx part 1
Sumo Logic Quick Start - Feb 2016
SQL Tunning
Sumo Logic QuickStart Webinar July 2016
Top 10 Oracle SQL tuning tips
How to analyze and tune sql queries for better performance webinar

More from aioughydchapter (7)

PDF
Role of DBAs in CLOUD ERA - AIOUG Hyd Chapter - Oracle Cloud Day
PDF
Oracle Cloud Day(IaaS, PaaS,SaaS) - AIOUG Hyd Chapter
PDF
Oracle rac cachefusion - High Availability Day 2015
PDF
Dmz aa aioug
PDF
Editioning use in ebs
PDF
Query optimizer vivek sharma
PDF
Performance tuning intro
Role of DBAs in CLOUD ERA - AIOUG Hyd Chapter - Oracle Cloud Day
Oracle Cloud Day(IaaS, PaaS,SaaS) - AIOUG Hyd Chapter
Oracle rac cachefusion - High Availability Day 2015
Dmz aa aioug
Editioning use in ebs
Query optimizer vivek sharma
Performance tuning intro

Recently uploaded (20)

PPTX
BSCE 2 NIGHT (CHAPTER 2) just cases.pptx
PDF
Laparoscopic Dissection Techniques at WLH
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PPTX
Why I Am A Baptist, History of the Baptist, The Baptist Distinctives, 1st Bap...
PDF
FYJC - Chemistry textbook - standard 11.
PPTX
Macbeth play - analysis .pptx english lit
PPTX
4. Diagnosis and treatment planning in RPD.pptx
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PPTX
Designing Adaptive Learning Paths in Virtual Learning Environments
PDF
Compact First Student's Book Cambridge Official
PPTX
2025 High Blood Pressure Guideline Slide Set.pptx
PDF
Physical education and sports and CWSN notes
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
Disorder of Endocrine system (1).pdfyyhyyyy
PDF
Hospital Case Study .architecture design
PDF
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PPT
hemostasis and its significance, physiology
PPTX
Diploma pharmaceutics notes..helps diploma students
PPTX
IT infrastructure and emerging technologies
BSCE 2 NIGHT (CHAPTER 2) just cases.pptx
Laparoscopic Dissection Techniques at WLH
faiz-khans about Radiotherapy Physics-02.pdf
Why I Am A Baptist, History of the Baptist, The Baptist Distinctives, 1st Bap...
FYJC - Chemistry textbook - standard 11.
Macbeth play - analysis .pptx english lit
4. Diagnosis and treatment planning in RPD.pptx
Everyday Spelling and Grammar by Kathi Wyldeck
Designing Adaptive Learning Paths in Virtual Learning Environments
Compact First Student's Book Cambridge Official
2025 High Blood Pressure Guideline Slide Set.pptx
Physical education and sports and CWSN notes
Nurlina - Urban Planner Portfolio (english ver)
Disorder of Endocrine system (1).pdfyyhyyyy
Hospital Case Study .architecture design
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
hemostasis and its significance, physiology
Diploma pharmaceutics notes..helps diploma students
IT infrastructure and emerging technologies

Indexes overview

  • 1. © Copyright 2015. Apps Associates LLC. 1 Performance Tuning Overview March 30, 2015
  • 2. © Copyright 2015. Apps Associates LLC. 2 Indexing
  • 3. © Copyright 2015. Apps Associates LLC. 3 0..50 51..100 101..150 …. 10000.. 10050 0..10 11..19 20..25 …. 47.. 50 51..58 59..63 64..75 …. 98.. 100 10000.. 10009 10010.. 10020 10021..10028 … 10046..10050 0,rowid 0,rowid 1,rowid …. 10,rowid 11,rowid 11,rowid 12,rowid …. 19,rowid 10046,rowid 10048,rowid 10048,rowid …. 10050,rowid …. …. 10021,rowid 10022,rowid 10023,rowid …. 10028,rowid …. Create index I on T(numColumn)
  • 4. © Copyright 2015. Apps Associates LLC. 4 B*Tree When to use • CLUSTERING FACTOR – A measure of how sorted the table is by the key in the index – It measures how many IO’s it would take to read the entire table via the index – row after row after row – If table is sorted by key, clustering factor near number of blocks in the table. – If table is not sorted by key, clustering factor nearer number of ROWS in table. – Please ask yourself, how many ways can the table be sorted on disk?
  • 5. © Copyright 2015. Apps Associates LLC. 5 1,Alice 2,Bob 3,Candy 4,Doug 5,Ellen 6,Frank 7,George 8,Hank …. …. …. …. …. … … … … … …. 0..50 51..100 101..150 …. 10000.. 100500..10 11..19 20..25 …. 47.. 50 51..58 59..63 64..75 …. 98.. 100 10000.. 10009 10010.. 10020 10021..10028 … 10046..10050 …. Create index nm_idx on name) Select * from t where pk between 1 and 8 Pk Name 1 Alice 2 Sue 3 Victor 4 Will Pk Name 5 Irene 6 Kelly 7 Melanie 8 Oliver Pk Name 9 George 10 Candy 11 Uwe 12 Wally Pk Name 13 Ellen 14 Tom 15 Rick 16 Paul Pk Name 17 Doug 18 Irene 19 Lance 20 Jack Pk Name 21 Hank 22 Frank 23 Nicole 24 Bob
  • 6. © Copyright 2015. Apps Associates LLC. 6 1,Alice 2,Bob 3,Candy 4,Doug 5,Ellen 6,Frank 7,George 8,Hank …. …. …. …. …. … … … … … …. 0..50 51..100 101..150 …. 10000.. 100500..10 11..19 20..25 …. 47.. 50 51..58 59..63 64..75 …. 98.. 100 10000.. 10009 10010.. 10020 10021..10028 … 10046..10050 …. Create index nm_idx on name) Select * from t where Name between ‘Alice’ and ‘Hank’ Pk Name 1 Alice 2 Sue 3 Victor 4 Will Pk Name 5 Irene 6 Kelly 7 Melanie 8 Oliver Pk Name 9 George 10 Candy 11 Uwe 12 Wally Pk Name 13 Ellen 14 Tom 15 Rick 16 Paul Pk Name 17 Doug 18 Irene 19 Lance 20 Jack Pk Name 21 Hank 22 Frank 23 Nicole 24 Bob
  • 7. Access paths – Getting the data Access Path Explanation Full table scan Reads all rows from table & filters out those that do not meet the where clause predicates. Used when no index, DOP set etc Table access by Rowid Rowid specifies the datafile & data block containing the row and the location of the row in that block. Used if rowid supplied by index or in where clause Index unique scan Only one row will be returned. Used when stmt contains a UNIQUE or a PRIMARY KEY constraint that guarantees that only a single row is accessed Index range scan Accesses adjacent index entries returns ROWID values Used with equality on non-unique indexes or range predicate on unique index (<.>, between etc) Index skip scan Skips the leading edge of the index & uses the rest Advantageous if there are few distinct values in the leading column and many distinct values in the non-leading column Full index scan Processes all leaf blocks of an index, but only enough branch blocks to find 1st leaf block. Used when all necessary columns are in index & order by clause matches index struct or if sort merge join is done Fast full index scan Scans all blocks in index used to replace a FTS when all necessary columns are in the index. Using multi-block IO & can going parallel Index joins Hash join of several indexes that together contain all the table columns that are referenced in the query. Wont eliminate a sort operation Bitmap indexes uses a bitmap for key values and a mapping function that converts each bit position to a rowid. Can efficiently merge indexes that correspond to several conditions in a WHERE clause
  • 8. © Copyright 2015. Apps Associates LLC. 8 Reverse Key Index • Physically stores the bytes of the keys in reverse order • In general, typically prevents range scanning – 5 is not stored next to 6 is not stored next to 7… • Used to avoid “hot block syndrome” • Can also be used to avoid having to re-organize a ‘sweeping’ index
  • 9. © Copyright 2015. Apps Associates LLC. 9 Reverse Key Index - performance • It can help with buffer busy waits – On monotonically increasing values – Eg: sequence populated fields – Eg: date/timestamp fields • Especially in a clustered environment, this can reduce latency • At the cost of additional CPU – Evident mostly in single user mode – When you go multi-user, because you are not spinning on a buffer wait, you see less overall CPU
  • 10. © Copyright 2015. Apps Associates LLC. 10 Reverse Key Index - performance • PL/SQL still more efficient • Reverse Key index has measurable impact for PL/SQL Single User PL/SQL Pro*C Reverse No Reverse Reverse No Reverse Transaction/second 38.24 43.45 17.35 19.08 CPU time (seconds) 25 22 33 31 Buffer busy waits number/time 0/0 0/0 0/0 0/0 Elapsed time (minutes) 0.42 0.37 0.92 0.83 Log file sync number/time 6/0 1,940/7 1,940/7
  • 11. © Copyright 2015. Apps Associates LLC. 11 Reverse Key Index - performance Transaction/second 46.59 49.03 20.07 20.29 CPU time (seconds) 77 73 104 101 Buffer busy waits number/time 4,267/2 133,644/2 3,286/0 23,688/1 Elapsed time (minutes) 0.68 0.65 1.58 1.57 Log file sync number/time 19/0 18/0 3,273/29 2,132/29 PL/SQL Pro*C Reverse No Reverse Reverse No Reverse • PL/SQL still more efficient • Reverse Key index has measurable impact for PL/SQL in this case Two Users
  • 12. © Copyright 2015. Apps Associates LLC. 12 Reverse Key Index - performance PL/SQL still more efficient Reverse Key index has impressively measurable effect As we scale up – this will have more of an impact At low concurrency, little impact Ten Users PL/SQL Pro*C Reverse No Reverse Reverse No Reverse Transaction/second 45.90 35.38 17.88 16.05 CPU time (seconds) 781 789 1,256 1,384 Buffer busy waits number/time 26k/279 456k/1,382 25k/134 364k/1702 Elapsed time (minutes) 3.47 4.50 8.90 9.92 Log file sync number/time 2,602/72 11k/196 12k/141
  • 13. What basic statistics to collect • By default the following basic table & column statistic are collected – Number of Rows – Number of blocks – Average row length – Number of distinct values – Number of nulls in column
  • 14. What basic statistics to collect • Index statistics are automatically gathered during creation and maintained by GATHER_TABLE_STATS and include – Number of leaf blocks – Branch Levels – Clustering factor • 12c – Tables have basic statistics gathered during loads into empty segments too
  • 15. What basic statistics to collect • Histograms tell Optimizer about the data distribution in a Column • Creation controlled by METHOD_OPT parameter • Default create histogram on any column that has been used in the WHERE clause or GROUP BY of a statement AND has a data skew • Relies on column usage information gathered at compilation time and stored in SYS.COL_USAGE$ Histograms
  • 16. What basic statistics to collect • 11g and before - Two types of histograms – Frequency – Height-balanced • 12c and after – two more – Top Frequency – Hybrid Histograms
  • 17. Histograms • A frequency histogram is only created if the number of distinct values in a column (NDV) is less than 254 values Frequency histograms (FREQUENCY) Frequency histogram
  • 18. Histograms • A height balanced histogram is created if the number of distinct values in a column (NDV) is greater than 254 values Height balanced histograms (HEIGHT BALANCED) Height balanced histogram
  • 19. Histograms • Traditionally a frequency histogram is only created if NDV < 254 • But if a small number of values occupies most of the rows (>99% rows) • Creating a frequency histograms on that small set of values is very useful even though NDV is greater than 254 • Ignores the unpopular values to create a better quality histogram for popular values • Built using the same technique used for frequency histograms • Only created with AUTO_SAMPLE_SIZE Top Frequency (TOP-FREQUENCY) 12c
  • 20. Histograms • Similar to height balanced histogram as created if the NDV >254 • Store the actual frequencies of bucket endpoints in histograms • No values are allowed to spill over multiple buckets • More endpoint values can be squeezed in a histogram • Achieves the same effect as increasing the # of buckets • Only created with AUTO_SAMPLE_SIZE Hybrid Histograms (HYBRID) 12c
  • 21. © Copyright 2015. Apps Associates LLC. 21