SlideShare a Scribd company logo
1 of 29
Indexes: Structure, Splits and Free 
Space Management Internals 
OakTable World, 29 September 2014 
Christian Antognini 
BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
1
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
2 
@ChrisAntognini 
 Senior principal consultant, trainer and partner 
at Trivadis in Zurich (CH) 
 christian.antognini@trivadis.com 
 http://antognini.ch 
 Focus: get the most out of Oracle Database 
 Logical and physical database design 
 Query optimizer 
 Application performance management 
 Author of Troubleshooting Oracle Performance 
Apress, 2008/2014 
 OakTable Network, Oracle ACE Director
AGENDA 
1. Concepts 
2. Index Keys 
3. Splits 
4. Free Space 
5. Reorganizations 
6. Bitmap 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
3
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
Concepts 
4
Structure of a B-Tree 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
5 
24 51 
12 29 42 86 
2 ROWID 
8 ROWID 
10 ROWID 
11 ROWID 
12 ROWID 
18 ROWID 
20 ROWID 
24 ROWID 
26 ROWID 
29 ROWID 
34 ROWID 
38 ROWID 
42 ROWID 51 ROWID 
55 ROWID 
73 ROWID 
branch 
blocks 
86 ROWID 
99 ROWID 
left<24 
right≥24 
leaf blocks 
root block
2014 © Trivadis 
Nulls 
 NULL values are stored in the index only when at least one of the 
indexed columns is not NULL 
 Exception: bitmap indexes always store indexed data 
 For unique indexes the uniqueness is guaranteed only if at least one of 
the indexed columns is not NULL 
 NULL values are stored after not NULL values in the index 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
6
2014 © Trivadis 
Myths 
 Oracle B-tree indexes can become “unbalanced” over time and need to 
be rebuilt 
 Deleted space in an index is “deadwood” and over time requires the 
index to be rebuilt 
 If an index reaches “x” number of levels, it becomes inefficient and 
requires the index to be rebuilt 
 If an index has a poor clustering factor, the index needs to be rebuilt 
 To improve performance, indexes need to be regularly rebuilt 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
7 
Source: Oracle B-Tree Index Internals: Rebuilding The Truth, Richard Foote
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
Index Keys 
8
Internal Key 
 Internally a unique key is needed to sort the indexed columns 
 For unique indexes the internal key is the same as the index key 
 For non-unique indexes the ROWID of the indexed row is added to the 
index key to make it unique 
 For global indexes an extended ROWID is used, otherwise a restricted 
ROWID is enough 
2014 © Trivadis 
 Therefore 
 The index entries are sorted in a consistent way 
 Even for non-unique indexed the order of the index entries changes only 
when the indexed table is reorganized (i.e. not if the index is rebuilt!) 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
9
Branch Block Key 
 In branch blocks the internal key is truncated after the first byte that 
differs from the last key of the left leaf block 
 All keys are preceded by a length field 
 1 byte for data up to 127 bytes 
 Otherwise 2 bytes 
- The high bit of the first byte is set (0x80) 
- The remaining bits of the first byte and the second byte contain the length 
 Partially stored keys are terminated by 0xFE 
 Nulls have a column length of 0xFF, trailing nulls are stored 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
10 
RDBA 
Len 
Key 1 
Data 
Key 1 
Len 
Key X 
Data 
Key X
Leaf Block Key 
 All keys are preceded by a length field 
 1 byte for data up to 127 bytes 
 Otherwise 2 bytes 
- The high bit of the first byte is set (0x80) 
- The remaining bits of the first byte and the second byte contain the length 
 Nulls have a column length of 0xFF, trailing nulls are stored 
 For global indexes an extended ROWID is used, otherwise a restricted 
ROWID is enough 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
11 
Flag Lock 
Len 
Key 1 
Data 
Key 1 
Len 
ROWID 
ROWID 
(optional)
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
Splits 
12
2014 © Trivadis 
Splits 
 Two split methods are implemented 
 50:50 split 
 The keys are evenly distributed over two blocks 
 Based on size, not number of keys 
 99:1 split (a.k.a. 90:10) 
 The new key is the right-most of the index 
 A new leaf block containing only the new key is added 
 Useful for increasing values like sequences and timestamps 
 A change in the structure of an index (like a split) is not rollbacked if the 
transaction that caused it is rollbacked 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
13
2014 © Trivadis 
Splits 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
14 
#1
2014 © Trivadis 
Splits 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
15 
#1 
#2 #3
2014 © Trivadis 
Splits 
#2 #4 #3 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
16 
#1 
#2 #3
2014 © Trivadis 
Splits 
#1 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
17 
#1 
#2 #4 #3 #5 
#2 #4 #3
2014 © Trivadis 
Splits 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
18
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
Free Space 
19
Reminder 
 PCTFREE is only used when the index is created (or rebuilt) 
 An update is implemented as a delete followed by an insert 
 The free space in leaf blocks is strongly dependent on the type of split (50:50 
2014 © Trivadis 
or 99:1) 
 PCTUSED cannot be used for indexes 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
20
Free Space 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
21 
#1 
#2 #3 #4
Free Space 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
22 
#1 
#2 #4 #3
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
Reorganizations 
23
Reorganizations 
 If the free space is not automatically reused, it should be manually 
reclaimed 
 This is unusual, therefore such an operation should only be performed if it is 
really necessary 
 To manually reclaim free space two possibilities exists 
 Rebuild: the index is recreated 
 Coalesce: free space in contiguous blocks is merged and, therefore, some 
blocks are unchained 
 Unnecessary rebuild/coalesce may lead to sub-optimal data density in 
leaf blocks 
 Too much free space, i.e. too low density 
 Too much block splits, i.e. too high density 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
24
Rebuild vs. Coalesce 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
25 
Pro Cons 
Rebuild 
 Doesn’t lock table 
(online rebuilds only) 
 Reclaim all the free 
space 
 Locks table during rebuild 
(offline rebuilds only) 
 Doubles space usage 
temporarily 
 The index is completely 
recreated (to do so large 
sorts may be performed) 
Coalesce 
 Doesn’t lock table 
 Current index structure is 
reused 
 Doesn’t reclaim all the free 
space 
 Can generate lot of redo
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
Bitmap 
26
2014 © Trivadis 
Bitmap 
 A bitmap index is a regular B-tree, only the internal key differs from the 
non-bitmap index! 
 The key is composed by 
 Indexed column(s) 
 Start/End ROWID 
 Bitmap representing the rows that have the key 
- To save space it is “compressed” 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
27
Summary 
2014 © Trivadis 
 B-tree indexes cannot become 
“unbalanced” 
 Deleted space in an index can 
be reused 
 Indexes do not need to be 
regularly rebuilt 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
28
Questions and answers ... 
Christian Antognini 
Senior Principal Consultant 
christian.antognini@trivadis.com 
BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA 
2014 © Trivadis 
Indexes: Structure, Splits and Free Space Management Internals 
29 September 2014 
29

More Related Content

What's hot

Properly Use Parallel DML for ETL
Properly Use Parallel DML for ETLProperly Use Parallel DML for ETL
Properly Use Parallel DML for ETLAndrej Pashchenko
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaaCuneyt Goksu
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaCuneyt Goksu
 
Adaptive Query Optimization in 12c
Adaptive Query Optimization in 12cAdaptive Query Optimization in 12c
Adaptive Query Optimization in 12cAnju Garg
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cDavid Yahalom
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query OptimizationAnju Garg
 
DB2 LUW Access Plan Stability
DB2 LUW Access Plan StabilityDB2 LUW Access Plan Stability
DB2 LUW Access Plan Stabilitydmcmichael
 
Understanding DB2 Optimizer
Understanding DB2 OptimizerUnderstanding DB2 Optimizer
Understanding DB2 Optimizerterraborealis
 
Db2 analytics accelerator technical update
Db2 analytics accelerator  technical updateDb2 analytics accelerator  technical update
Db2 analytics accelerator technical updateCuneyt Goksu
 
Dan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesDan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesEmbarcadero Technologies
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuningGuy Harrison
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trendsCuneyt Goksu
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ICarlos Oliveira
 
Developers' mDay 2017. - Bogdan Kecman Oracle
Developers' mDay 2017. - Bogdan Kecman OracleDevelopers' mDay 2017. - Bogdan Kecman Oracle
Developers' mDay 2017. - Bogdan Kecman OraclemCloud
 
Indexing in Exadata
Indexing in ExadataIndexing in Exadata
Indexing in ExadataEnkitec
 
PostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability ImprovementsPostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability ImprovementsPGConf APAC
 
Part2 Best Practices for Managing Optimizer Statistics
Part2 Best Practices for Managing Optimizer StatisticsPart2 Best Practices for Managing Optimizer Statistics
Part2 Best Practices for Managing Optimizer StatisticsMaria Colgan
 
Best Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerBest Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerEdgar Alejandro Villegas
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performanceGuy Harrison
 
Part1 of SQL Tuning Workshop - Understanding the Optimizer
Part1 of SQL Tuning Workshop - Understanding the OptimizerPart1 of SQL Tuning Workshop - Understanding the Optimizer
Part1 of SQL Tuning Workshop - Understanding the OptimizerMaria Colgan
 

What's hot (20)

Properly Use Parallel DML for ETL
Properly Use Parallel DML for ETLProperly Use Parallel DML for ETL
Properly Use Parallel DML for ETL
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
 
Adaptive Query Optimization in 12c
Adaptive Query Optimization in 12cAdaptive Query Optimization in 12c
Adaptive Query Optimization in 12c
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query Optimization
 
DB2 LUW Access Plan Stability
DB2 LUW Access Plan StabilityDB2 LUW Access Plan Stability
DB2 LUW Access Plan Stability
 
Understanding DB2 Optimizer
Understanding DB2 OptimizerUnderstanding DB2 Optimizer
Understanding DB2 Optimizer
 
Db2 analytics accelerator technical update
Db2 analytics accelerator  technical updateDb2 analytics accelerator  technical update
Db2 analytics accelerator technical update
 
Dan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesDan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New Features
 
Oracle sql high performance tuning
Oracle sql high performance tuningOracle sql high performance tuning
Oracle sql high performance tuning
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trends
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
 
Developers' mDay 2017. - Bogdan Kecman Oracle
Developers' mDay 2017. - Bogdan Kecman OracleDevelopers' mDay 2017. - Bogdan Kecman Oracle
Developers' mDay 2017. - Bogdan Kecman Oracle
 
Indexing in Exadata
Indexing in ExadataIndexing in Exadata
Indexing in Exadata
 
PostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability ImprovementsPostgreSQL 9.6 Performance-Scalability Improvements
PostgreSQL 9.6 Performance-Scalability Improvements
 
Part2 Best Practices for Managing Optimizer Statistics
Part2 Best Practices for Managing Optimizer StatisticsPart2 Best Practices for Managing Optimizer Statistics
Part2 Best Practices for Managing Optimizer Statistics
 
Best Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle OptimizerBest Practices for Oracle Exadata and the Oracle Optimizer
Best Practices for Oracle Exadata and the Oracle Optimizer
 
Top 10 tips for Oracle performance
Top 10 tips for Oracle performanceTop 10 tips for Oracle performance
Top 10 tips for Oracle performance
 
Part1 of SQL Tuning Workshop - Understanding the Optimizer
Part1 of SQL Tuning Workshop - Understanding the OptimizerPart1 of SQL Tuning Workshop - Understanding the Optimizer
Part1 of SQL Tuning Workshop - Understanding the Optimizer
 

Viewers also liked

Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writerKyle Hailey
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linuxKyle Hailey
 
DevOps and its impact
DevOps and its impactDevOps and its impact
DevOps and its impactCisco DevNet
 
Free Load Testing Tools for Oracle Database – Which One Do I Use?
Free Load Testing Tools for Oracle Database – Which One Do I Use?Free Load Testing Tools for Oracle Database – Which One Do I Use?
Free Load Testing Tools for Oracle Database – Which One Do I Use?Christian Antognini
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata securityKyle Hailey
 
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
Mark Farnam  : Minimizing the Concurrency Footprint of TransactionsMark Farnam  : Minimizing the Concurrency Footprint of Transactions
Mark Farnam : Minimizing the Concurrency Footprint of TransactionsKyle Hailey
 
OakTable World Sep14 clonedb
OakTable World Sep14 clonedb OakTable World Sep14 clonedb
OakTable World Sep14 clonedb Connor McDonald
 
Free space managment46
Free space managment46Free space managment46
Free space managment46myrajendra
 
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!Kyle Hailey
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...Marco Gralike
 
ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012Amazon Web Services
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Kyle Hailey
 
How to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemHow to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemCary Millsap
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersKyle Hailey
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upAWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upJohn Beresniewicz
 
Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?Ludovico Caldara
 
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseOaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseKyle Hailey
 
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyOracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyPythian
 

Viewers also liked (20)

Profiling the logwriter and database writer
Profiling the logwriter and database writerProfiling the logwriter and database writer
Profiling the logwriter and database writer
 
Christo kutrovsky oracle, memory & linux
Christo kutrovsky   oracle, memory & linuxChristo kutrovsky   oracle, memory & linux
Christo kutrovsky oracle, memory & linux
 
DevOps and its impact
DevOps and its impactDevOps and its impact
DevOps and its impact
 
Free Load Testing Tools for Oracle Database – Which One Do I Use?
Free Load Testing Tools for Oracle Database – Which One Do I Use?Free Load Testing Tools for Oracle Database – Which One Do I Use?
Free Load Testing Tools for Oracle Database – Which One Do I Use?
 
Dan Norris: Exadata security
Dan Norris: Exadata securityDan Norris: Exadata security
Dan Norris: Exadata security
 
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
Mark Farnam  : Minimizing the Concurrency Footprint of TransactionsMark Farnam  : Minimizing the Concurrency Footprint of Transactions
Mark Farnam : Minimizing the Concurrency Footprint of Transactions
 
OakTable World Sep14 clonedb
OakTable World Sep14 clonedb OakTable World Sep14 clonedb
OakTable World Sep14 clonedb
 
Free space managment46
Free space managment46Free space managment46
Free space managment46
 
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!Oaktable World 2014 Kevin Closson:  SLOB – For More Than I/O!
Oaktable World 2014 Kevin Closson: SLOB – For More Than I/O!
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
 
ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012ARC202 Architecting for High Availability - AWS re: Invent 2012
ARC202 Architecting for High Availability - AWS re: Invent 2012
 
Intro to ASH
Intro to ASHIntro to ASH
Intro to ASH
 
Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle Ash masters : advanced ash analytics on Oracle
Ash masters : advanced ash analytics on Oracle
 
How to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problemHow to find and fix your Oracle application performance problem
How to find and fix your Oracle application performance problem
 
Oracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmastersOracle Open World Thursday 230 ashmasters
Oracle Open World Thursday 230 ashmasters
 
AWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add upAWR Ambiguity: Performance reasoning when the numbers don't add up
AWR Ambiguity: Performance reasoning when the numbers don't add up
 
Data control
Data controlData control
Data control
 
Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?Oracle Database on ACFS: a perfect marriage?
Oracle Database on ACFS: a perfect marriage?
 
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuseOaktable World 2014 Toon Koppelaars: database constraints polite excuse
Oaktable World 2014 Toon Koppelaars: database constraints polite excuse
 
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing DifferentlyOracle Database Security: Top 10 Things You Could & Should Be Doing Differently
Oracle Database Security: Top 10 Things You Could & Should Be Doing Differently
 

Similar to Oracle Index Structure and Management

Partitioning your Oracle Data Warehouse - Just a simple task?
Partitioning your Oracle Data Warehouse - Just a simple task?Partitioning your Oracle Data Warehouse - Just a simple task?
Partitioning your Oracle Data Warehouse - Just a simple task?Trivadis
 
Data Warehousing and Bitmap Indexes - More than just some bits
Data Warehousing and Bitmap Indexes  - More than just some bitsData Warehousing and Bitmap Indexes  - More than just some bits
Data Warehousing and Bitmap Indexes - More than just some bitsTrivadis
 
Steam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexesSteam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexesinovia
 
Software System Engineering - Chapter 15
Software System Engineering - Chapter 15Software System Engineering - Chapter 15
Software System Engineering - Chapter 15Fadhil Ismail
 
Management productivity tools1
Management productivity tools1Management productivity tools1
Management productivity tools1Hari Krishnan
 
Management productivity tools1
Management productivity tools1Management productivity tools1
Management productivity tools1hari krishnan.n
 
Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Taymoor Nazmy
 
Top 10 Interview Questions for Solidworks
Top 10 Interview Questions for SolidworksTop 10 Interview Questions for Solidworks
Top 10 Interview Questions for SolidworksEME Technologies
 
Five Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your IndexingFive Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your IndexingMaria Colgan
 
Top 35-interview-questions-on-sap-abap
Top 35-interview-questions-on-sap-abapTop 35-interview-questions-on-sap-abap
Top 35-interview-questions-on-sap-abapprathamesh4865
 
Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008wharrislv
 
Tableau interview questions www.bigclasses.com
Tableau interview questions www.bigclasses.comTableau interview questions www.bigclasses.com
Tableau interview questions www.bigclasses.combigclasses.com
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxJasonTuran2
 

Similar to Oracle Index Structure and Management (20)

Partitioning your Oracle Data Warehouse - Just a simple task?
Partitioning your Oracle Data Warehouse - Just a simple task?Partitioning your Oracle Data Warehouse - Just a simple task?
Partitioning your Oracle Data Warehouse - Just a simple task?
 
Data Warehousing and Bitmap Indexes - More than just some bits
Data Warehousing and Bitmap Indexes  - More than just some bitsData Warehousing and Bitmap Indexes  - More than just some bits
Data Warehousing and Bitmap Indexes - More than just some bits
 
Indexes overview
Indexes overviewIndexes overview
Indexes overview
 
Steam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexesSteam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexes
 
Vertex BD. Development of 2014 version.
Vertex BD. Development of 2014 version.Vertex BD. Development of 2014 version.
Vertex BD. Development of 2014 version.
 
Software System Engineering - Chapter 15
Software System Engineering - Chapter 15Software System Engineering - Chapter 15
Software System Engineering - Chapter 15
 
Management productivity tools1
Management productivity tools1Management productivity tools1
Management productivity tools1
 
Management productivity tools1
Management productivity tools1Management productivity tools1
Management productivity tools1
 
Module08
Module08Module08
Module08
 
Module08
Module08Module08
Module08
 
Software Engineering Lec 8-design-
Software Engineering Lec 8-design-Software Engineering Lec 8-design-
Software Engineering Lec 8-design-
 
Top 10 Interview Questions for Solidworks
Top 10 Interview Questions for SolidworksTop 10 Interview Questions for Solidworks
Top 10 Interview Questions for Solidworks
 
Five Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your IndexingFive Tips to Get the Most Out of Your Indexing
Five Tips to Get the Most Out of Your Indexing
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Top 35-interview-questions-on-sap-abap
Top 35-interview-questions-on-sap-abapTop 35-interview-questions-on-sap-abap
Top 35-interview-questions-on-sap-abap
 
Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008Filtered Indexes In Sql 2008
Filtered Indexes In Sql 2008
 
CREO / PROE QUESTIONS
CREO / PROE QUESTIONSCREO / PROE QUESTIONS
CREO / PROE QUESTIONS
 
Tableau interview questions www.bigclasses.com
Tableau interview questions www.bigclasses.comTableau interview questions www.bigclasses.com
Tableau interview questions www.bigclasses.com
 
Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptx
 
BUS-Chapter 07.ppt
BUS-Chapter 07.pptBUS-Chapter 07.ppt
BUS-Chapter 07.ppt
 

Recently uploaded

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Oracle Index Structure and Management

  • 1. Indexes: Structure, Splits and Free Space Management Internals OakTable World, 29 September 2014 Christian Antognini BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 1
  • 2. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 2 @ChrisAntognini  Senior principal consultant, trainer and partner at Trivadis in Zurich (CH)  christian.antognini@trivadis.com  http://antognini.ch  Focus: get the most out of Oracle Database  Logical and physical database design  Query optimizer  Application performance management  Author of Troubleshooting Oracle Performance Apress, 2008/2014  OakTable Network, Oracle ACE Director
  • 3. AGENDA 1. Concepts 2. Index Keys 3. Splits 4. Free Space 5. Reorganizations 6. Bitmap 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 3
  • 4. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 Concepts 4
  • 5. Structure of a B-Tree 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 5 24 51 12 29 42 86 2 ROWID 8 ROWID 10 ROWID 11 ROWID 12 ROWID 18 ROWID 20 ROWID 24 ROWID 26 ROWID 29 ROWID 34 ROWID 38 ROWID 42 ROWID 51 ROWID 55 ROWID 73 ROWID branch blocks 86 ROWID 99 ROWID left<24 right≥24 leaf blocks root block
  • 6. 2014 © Trivadis Nulls  NULL values are stored in the index only when at least one of the indexed columns is not NULL  Exception: bitmap indexes always store indexed data  For unique indexes the uniqueness is guaranteed only if at least one of the indexed columns is not NULL  NULL values are stored after not NULL values in the index Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 6
  • 7. 2014 © Trivadis Myths  Oracle B-tree indexes can become “unbalanced” over time and need to be rebuilt  Deleted space in an index is “deadwood” and over time requires the index to be rebuilt  If an index reaches “x” number of levels, it becomes inefficient and requires the index to be rebuilt  If an index has a poor clustering factor, the index needs to be rebuilt  To improve performance, indexes need to be regularly rebuilt Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 7 Source: Oracle B-Tree Index Internals: Rebuilding The Truth, Richard Foote
  • 8. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 Index Keys 8
  • 9. Internal Key  Internally a unique key is needed to sort the indexed columns  For unique indexes the internal key is the same as the index key  For non-unique indexes the ROWID of the indexed row is added to the index key to make it unique  For global indexes an extended ROWID is used, otherwise a restricted ROWID is enough 2014 © Trivadis  Therefore  The index entries are sorted in a consistent way  Even for non-unique indexed the order of the index entries changes only when the indexed table is reorganized (i.e. not if the index is rebuilt!) Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 9
  • 10. Branch Block Key  In branch blocks the internal key is truncated after the first byte that differs from the last key of the left leaf block  All keys are preceded by a length field  1 byte for data up to 127 bytes  Otherwise 2 bytes - The high bit of the first byte is set (0x80) - The remaining bits of the first byte and the second byte contain the length  Partially stored keys are terminated by 0xFE  Nulls have a column length of 0xFF, trailing nulls are stored 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 10 RDBA Len Key 1 Data Key 1 Len Key X Data Key X
  • 11. Leaf Block Key  All keys are preceded by a length field  1 byte for data up to 127 bytes  Otherwise 2 bytes - The high bit of the first byte is set (0x80) - The remaining bits of the first byte and the second byte contain the length  Nulls have a column length of 0xFF, trailing nulls are stored  For global indexes an extended ROWID is used, otherwise a restricted ROWID is enough 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 11 Flag Lock Len Key 1 Data Key 1 Len ROWID ROWID (optional)
  • 12. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 Splits 12
  • 13. 2014 © Trivadis Splits  Two split methods are implemented  50:50 split  The keys are evenly distributed over two blocks  Based on size, not number of keys  99:1 split (a.k.a. 90:10)  The new key is the right-most of the index  A new leaf block containing only the new key is added  Useful for increasing values like sequences and timestamps  A change in the structure of an index (like a split) is not rollbacked if the transaction that caused it is rollbacked Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 13
  • 14. 2014 © Trivadis Splits Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 14 #1
  • 15. 2014 © Trivadis Splits Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 15 #1 #2 #3
  • 16. 2014 © Trivadis Splits #2 #4 #3 Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 16 #1 #2 #3
  • 17. 2014 © Trivadis Splits #1 Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 17 #1 #2 #4 #3 #5 #2 #4 #3
  • 18. 2014 © Trivadis Splits Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 18
  • 19. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 Free Space 19
  • 20. Reminder  PCTFREE is only used when the index is created (or rebuilt)  An update is implemented as a delete followed by an insert  The free space in leaf blocks is strongly dependent on the type of split (50:50 2014 © Trivadis or 99:1)  PCTUSED cannot be used for indexes Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 20
  • 21. Free Space 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 21 #1 #2 #3 #4
  • 22. Free Space 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 22 #1 #2 #4 #3
  • 23. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 Reorganizations 23
  • 24. Reorganizations  If the free space is not automatically reused, it should be manually reclaimed  This is unusual, therefore such an operation should only be performed if it is really necessary  To manually reclaim free space two possibilities exists  Rebuild: the index is recreated  Coalesce: free space in contiguous blocks is merged and, therefore, some blocks are unchained  Unnecessary rebuild/coalesce may lead to sub-optimal data density in leaf blocks  Too much free space, i.e. too low density  Too much block splits, i.e. too high density 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 24
  • 25. Rebuild vs. Coalesce 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 25 Pro Cons Rebuild  Doesn’t lock table (online rebuilds only)  Reclaim all the free space  Locks table during rebuild (offline rebuilds only)  Doubles space usage temporarily  The index is completely recreated (to do so large sorts may be performed) Coalesce  Doesn’t lock table  Current index structure is reused  Doesn’t reclaim all the free space  Can generate lot of redo
  • 26. 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 Bitmap 26
  • 27. 2014 © Trivadis Bitmap  A bitmap index is a regular B-tree, only the internal key differs from the non-bitmap index!  The key is composed by  Indexed column(s)  Start/End ROWID  Bitmap representing the rows that have the key - To save space it is “compressed” Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 27
  • 28. Summary 2014 © Trivadis  B-tree indexes cannot become “unbalanced”  Deleted space in an index can be reused  Indexes do not need to be regularly rebuilt Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 28
  • 29. Questions and answers ... Christian Antognini Senior Principal Consultant christian.antognini@trivadis.com BASEL BERN BRUGG LAUSANNE ZUERICH DUESSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MUNICH STUTTGART VIENNA 2014 © Trivadis Indexes: Structure, Splits and Free Space Management Internals 29 September 2014 29