SlideShare a Scribd company logo
1 of 19
Online Index Rebuild
Automation
on a multitenant fleet
Carlos Sierra
Motivation
• Improve performance of Execution Plans which include Index Fast Full
Scans (IFFS)
• Or large Index Range Scans operations
• Shrink large bloated indexes to reduce Tablespace growth
• Thus reduce respective space alerts
Case study
• Custom key-value infrastructure application installed in 30+ CDBs and
700+ PDBs
• Multi-versioning implemented at the application layer
• Sequence-based transaction id as versioning mechanism
• Most indexes monolithically increasing in one or more columns
• Target query execution time in the order of few milliseconds, or < 1ms
• “Optimal” execution plans often call for IFFS or long index scans
• Many indexes with wasted space > 25%, some with > 95%
Sample indexes
• DB_SYSTEMS_PK (ID, TXNID)
• I_DB_SYS_BY_COMPARTMENT (COMPARTMENTID, TXNID)
• TRANSACTIONS_PK (TRANSACTIONID)
• TRANSACTIONS_AK (COMMITTRANSACTIONID, STATUS, TRANSACTIONID)
• TRANSACTIONS_AK2 (TRANSACTIONID, BEGINTIME)
• TRANSACTIONS_AK3 (STATUS, COMMITTRANSACTIONID, TRANSACTIONID)
• TRANSACTIONKEYS_PK (TRANSACTIONID, STEPNUMBER)
• TRANSACTIONKEYS_AK (COMMITTRANSACTIONID, BUCKETID)
Typical query
SELECT
<bunch of columns>
FROM
DB_SYSTEMS
WHERE
(id, TxnID, 1) IN (
SELECT
id, TxnID,
ROW_NUMBER() OVER (PARTITION BY id ORDER BY TxnID DESC) rn
FROM
DB_SYSTEMS
WHERE
TxnID <= :1
)
AND Live = 'Y'
AND compartmentId = :2
ORDER BY
compartmentId ASC, id ASC
FETCH FIRST :3 ROWS ONLY
Typical execution plan
---------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | Buffers |
---------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | 1 | 70976 |
|* 1 | VIEW | | 1 | 31 | 1 | 70976 |
|* 2 | WINDOW SORT PUSHED RANK | | 1 | 31 | 1 | 70976 |
| 3 | NESTED LOOPS | | 1 | 31 | 1 | 70976 |
|* 4 | TABLE ACCESS BY INDEX ROWID BATCHED| DB_SYSTEMS | 1 | 2375 | 2462 | 2383 |
|* 5 | INDEX RANGE SCAN | I_DB_SYS_BY_COMPARTMENT | 1 | 2375 | 2462 | 200 |
|* 6 | VIEW PUSHED PREDICATE | VW_NSO_1 | 2462 | 1 | 1 | 68593 |
| 7 | WINDOW BUFFER | | 2462 | 2 | 1 | 68593 |
|* 8 | INDEX RANGE SCAN DESCENDING | DB_SYSTEMS_PK | 2462 | 2 | 1 | 68593 |
---------------------------------------------------------------------------------------------------------------
• Scan entire set of matching rows for given compartment, then for each row scan all matching rows for
specific id, finding the one with largest transaction id. If row from outer scan matches the max from inner
scan then return it.
• For popular values this nested loop scan means O(N2) complexity
Alternative execution plans
• Nested loops with subquery as outer rows source
• Hash join with row sources accessed by
• Full scans on table
• Full scans on indexes
• Large range scans
Performance of some known execution plans
AVG_ET_SECS_AWR PLAN_HASH_VALUE NL HJ P99_ET_SECS P95_ET_SECS
--------------- --------------- --- --- ----------- -----------
0.040205 1339591056 0 1 0.054080 0.054080
0.058834 979865086 0 1 0.064525 0.064329
0.072383 3083557534 0 1 0.081679 0.081338
1.545154 1910733940 1 0 3.384472 3.217428
• Nested Loops plan with historical average performance per execution of 1.5s, 99th
percentile of 3.4s and 95th percentile of 3.2s
• 3 Hash-Join plans with average performance in the 40ms to 72ms range
• Best performant HJ plan with 40ms on average, and 95th percentile of 54ms
Two of the “optimal” HJ plans
Case study rules of thumb
• Queries are constrained by FETCH FIRST :b ROWS ONLY
• If unconstrained, the query were to return many rows, then NL plans
may perform better on average than HJ plans
• If unconstrained, the query were to return few or no rows, then HJ
plans may perform better on average than NL plans
• Consistent performance is perceived as more valuable than better
performance
• Then HJ plans are often the right answer!
Candidate indexes for rebuild
• Larger than 10 MB
• Wasted space of over 25%
• They are accessed through a FULL SCAN
• As per execution plans in memory or last 7 days of AWR history
Exclusions and inclusions
• Exclude indexes from a TRANSACTIONS table for which the
application performs an explicit LOCK EXCLUSIVE
• Regardless of size or wasted space
• Include indexes from a TRANSACTIONKEYS table that are known to be
the largest on many PDBs
• Only if > 10 MB and wasted space > 25%
Some large bloated indexes
• Not referenced by IFFS or large
range scans
• Average size of a Tablespace for
a PDB is 100 GB
• These 4 indexes are usually the
largest ones on a PDB
• Wasted space for some indexes
in the order of 90%
Online Index Rebuild Automation
• OEM Job executed weekly on every CDB of the fleet
• Loop over all PDBs
• Loop over all candidate indexes per PDB
• Considering thresholds (space and savings) plus exceptions
• Execute online index rebuild
• Wait 2 minutes between indexes being rebuilt
• Log into 3 places
• Trace file
• Report (spool file)
• Alert log
Results: sensible space reduction
• 130s to 135s per index including 120s between them. Thus ~10s to ~15s per index on average
• No visible contention during “eyes-on-glass” on two monitored “online rebuild” cycles of entire fleet
• 105 to 142 GB of saved space per CDB on first cycle (including large bloated indexes). Savings ~90%
Results: small “overall” performance gain
• Real gain is on short-latency queries performing full scans on rebuilt indexes
• Performance of IFFS operation is proportional to index size
Moving forward
• Tune online index rebuild autonomous job
• Adjust size (10 MB) and savings (25%) thresholds
• Reduce transaction’s retention window
• Target: as short as business permits (maybe 2h)
• Perform aggressive garbage collection
• Implement monitoring job with alarming capabilities
• Implement index compression
• On leading wide-columns with low to medium cardinality
• Evaluate shrinking tables with a new autonomous job
• Using online table redefinition
Further improvements
• Adapt and adopt SPM to achieve plan stability on critical SQL
• Implement a smart algorithm based on current and historical performance
• Some of the chosen plans will contain IFFS and HJ
• Address currently excluded table
• Promote EXCLUSIVE TABLE LOCK to a DBMS_LOCK
• Improve dynamic SQL eliminating “versioning” subquery
• Include ending transaction on each row
• Pair Oracle system change number (SCN) to transactions, and use AS OF

More Related Content

What's hot

Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsEnkitec
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
SQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cTanel Poder
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsCarlos Sierra
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 ToolCarlos Sierra
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performanceMauro Pagano
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTanel Poder
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the TradeCarlos Sierra
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsZohar Elkayam
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTanel Poder
 
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
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizerMauro Pagano
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1SolarWinds
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Sandesh Rao
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 

What's hot (20)

SQLd360
SQLd360SQLd360
SQLd360
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)Tanel Poder Oracle Scripts and Tools (2010)
Tanel Poder Oracle Scripts and Tools (2010)
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 2
 
AWR and ASH Deep Dive
AWR and ASH Deep DiveAWR and ASH Deep Dive
AWR and ASH Deep Dive
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
SQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12cSQL Monitoring in Oracle Database 12c
SQL Monitoring in Oracle Database 12c
 
Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Introducing the eDB360 Tool
Introducing the eDB360 ToolIntroducing the eDB360 Tool
Introducing the eDB360 Tool
 
Same plan different performance
Same plan different performanceSame plan different performance
Same plan different performance
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
 
Oracle Performance Tools of the Trade
Oracle Performance Tools of the TradeOracle Performance Tools of the Trade
Oracle Performance Tools of the Trade
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 
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
 
Analyzing awr report
Analyzing awr reportAnalyzing awr report
Analyzing awr report
 
Chasing the optimizer
Chasing the optimizerChasing the optimizer
Chasing the optimizer
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 

Similar to Online index rebuild automation

Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxJasonTuran2
 
ClustrixDB 7.5 Announcement
ClustrixDB 7.5 AnnouncementClustrixDB 7.5 Announcement
ClustrixDB 7.5 AnnouncementClustrix
 
Best Practices – Extreme Performance with Data Warehousing on Oracle Databa...
Best Practices –  Extreme Performance with Data Warehousing  on Oracle Databa...Best Practices –  Extreme Performance with Data Warehousing  on Oracle Databa...
Best Practices – Extreme Performance with Data Warehousing on Oracle Databa...Edgar Alejandro Villegas
 
Reduced instruction set computers
Reduced instruction set computersReduced instruction set computers
Reduced instruction set computersSyed Zaid Irshad
 
Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Ismail Mukiibi
 
ebs-performance-tuning-part-1-470542.pdf
ebs-performance-tuning-part-1-470542.pdfebs-performance-tuning-part-1-470542.pdf
ebs-performance-tuning-part-1-470542.pdfElboulmaniMohamed
 
Get the most out of your AWS Redshift investment while keeping cost down
Get the most out of your AWS Redshift investment while keeping cost downGet the most out of your AWS Redshift investment while keeping cost down
Get the most out of your AWS Redshift investment while keeping cost downAgilisium Consulting
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfElboulmaniMohamed
 
(Re)Indexing Large Repositories in Alfresco
(Re)Indexing Large Repositories in Alfresco(Re)Indexing Large Repositories in Alfresco
(Re)Indexing Large Repositories in AlfrescoAngel Borroy López
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502kaziul Islam Bulbul
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewNorberto Leite
 
IMS09 ims v14 higlights
IMS09   ims v14 higlightsIMS09   ims v14 higlights
IMS09 ims v14 higlightsRobert Hain
 
Service-Level Objective for Serverless Applications
Service-Level Objective for Serverless ApplicationsService-Level Objective for Serverless Applications
Service-Level Objective for Serverless Applicationsalekn
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryWhy & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryAntonios Chatzipavlis
 
Migrate to platform of your choice
Migrate to platform of your choiceMigrate to platform of your choice
Migrate to platform of your choiceAshnikbiz
 
Best storage engine for MySQL
Best storage engine for MySQLBest storage engine for MySQL
Best storage engine for MySQLtomflemingh2
 

Similar to Online index rebuild automation (20)

Optimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptxOptimizing Application Performance - 2022.pptx
Optimizing Application Performance - 2022.pptx
 
ClustrixDB 7.5 Announcement
ClustrixDB 7.5 AnnouncementClustrixDB 7.5 Announcement
ClustrixDB 7.5 Announcement
 
Best Practices – Extreme Performance with Data Warehousing on Oracle Databa...
Best Practices –  Extreme Performance with Data Warehousing  on Oracle Databa...Best Practices –  Extreme Performance with Data Warehousing  on Oracle Databa...
Best Practices – Extreme Performance with Data Warehousing on Oracle Databa...
 
Reduced instruction set computers
Reduced instruction set computersReduced instruction set computers
Reduced instruction set computers
 
Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6Advanced computer architecture lesson 5 and 6
Advanced computer architecture lesson 5 and 6
 
RISC.ppt
RISC.pptRISC.ppt
RISC.ppt
 
13 risc
13 risc13 risc
13 risc
 
ebs-performance-tuning-part-1-470542.pdf
ebs-performance-tuning-part-1-470542.pdfebs-performance-tuning-part-1-470542.pdf
ebs-performance-tuning-part-1-470542.pdf
 
A12 vercelletto indexing_techniques
A12 vercelletto indexing_techniquesA12 vercelletto indexing_techniques
A12 vercelletto indexing_techniques
 
13 risc
13 risc13 risc
13 risc
 
Get the most out of your AWS Redshift investment while keeping cost down
Get the most out of your AWS Redshift investment while keeping cost downGet the most out of your AWS Redshift investment while keeping cost down
Get the most out of your AWS Redshift investment while keeping cost down
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdf
 
(Re)Indexing Large Repositories in Alfresco
(Re)Indexing Large Repositories in Alfresco(Re)Indexing Large Repositories in Alfresco
(Re)Indexing Large Repositories in Alfresco
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature Preview
 
IMS09 ims v14 higlights
IMS09   ims v14 higlightsIMS09   ims v14 higlights
IMS09 ims v14 higlights
 
Service-Level Objective for Serverless Applications
Service-Level Objective for Serverless ApplicationsService-Level Objective for Serverless Applications
Service-Level Objective for Serverless Applications
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryWhy & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to query
 
Migrate to platform of your choice
Migrate to platform of your choiceMigrate to platform of your choice
Migrate to platform of your choice
 
Best storage engine for MySQL
Best storage engine for MySQLBest storage engine for MySQL
Best storage engine for MySQL
 

Recently uploaded

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Online index rebuild automation

  • 1. Online Index Rebuild Automation on a multitenant fleet Carlos Sierra
  • 2. Motivation • Improve performance of Execution Plans which include Index Fast Full Scans (IFFS) • Or large Index Range Scans operations • Shrink large bloated indexes to reduce Tablespace growth • Thus reduce respective space alerts
  • 3. Case study • Custom key-value infrastructure application installed in 30+ CDBs and 700+ PDBs • Multi-versioning implemented at the application layer • Sequence-based transaction id as versioning mechanism • Most indexes monolithically increasing in one or more columns • Target query execution time in the order of few milliseconds, or < 1ms • “Optimal” execution plans often call for IFFS or long index scans • Many indexes with wasted space > 25%, some with > 95%
  • 4. Sample indexes • DB_SYSTEMS_PK (ID, TXNID) • I_DB_SYS_BY_COMPARTMENT (COMPARTMENTID, TXNID) • TRANSACTIONS_PK (TRANSACTIONID) • TRANSACTIONS_AK (COMMITTRANSACTIONID, STATUS, TRANSACTIONID) • TRANSACTIONS_AK2 (TRANSACTIONID, BEGINTIME) • TRANSACTIONS_AK3 (STATUS, COMMITTRANSACTIONID, TRANSACTIONID) • TRANSACTIONKEYS_PK (TRANSACTIONID, STEPNUMBER) • TRANSACTIONKEYS_AK (COMMITTRANSACTIONID, BUCKETID)
  • 5. Typical query SELECT <bunch of columns> FROM DB_SYSTEMS WHERE (id, TxnID, 1) IN ( SELECT id, TxnID, ROW_NUMBER() OVER (PARTITION BY id ORDER BY TxnID DESC) rn FROM DB_SYSTEMS WHERE TxnID <= :1 ) AND Live = 'Y' AND compartmentId = :2 ORDER BY compartmentId ASC, id ASC FETCH FIRST :3 ROWS ONLY
  • 6. Typical execution plan --------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows | Buffers | --------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | 1 | 70976 | |* 1 | VIEW | | 1 | 31 | 1 | 70976 | |* 2 | WINDOW SORT PUSHED RANK | | 1 | 31 | 1 | 70976 | | 3 | NESTED LOOPS | | 1 | 31 | 1 | 70976 | |* 4 | TABLE ACCESS BY INDEX ROWID BATCHED| DB_SYSTEMS | 1 | 2375 | 2462 | 2383 | |* 5 | INDEX RANGE SCAN | I_DB_SYS_BY_COMPARTMENT | 1 | 2375 | 2462 | 200 | |* 6 | VIEW PUSHED PREDICATE | VW_NSO_1 | 2462 | 1 | 1 | 68593 | | 7 | WINDOW BUFFER | | 2462 | 2 | 1 | 68593 | |* 8 | INDEX RANGE SCAN DESCENDING | DB_SYSTEMS_PK | 2462 | 2 | 1 | 68593 | --------------------------------------------------------------------------------------------------------------- • Scan entire set of matching rows for given compartment, then for each row scan all matching rows for specific id, finding the one with largest transaction id. If row from outer scan matches the max from inner scan then return it. • For popular values this nested loop scan means O(N2) complexity
  • 7. Alternative execution plans • Nested loops with subquery as outer rows source • Hash join with row sources accessed by • Full scans on table • Full scans on indexes • Large range scans
  • 8. Performance of some known execution plans AVG_ET_SECS_AWR PLAN_HASH_VALUE NL HJ P99_ET_SECS P95_ET_SECS --------------- --------------- --- --- ----------- ----------- 0.040205 1339591056 0 1 0.054080 0.054080 0.058834 979865086 0 1 0.064525 0.064329 0.072383 3083557534 0 1 0.081679 0.081338 1.545154 1910733940 1 0 3.384472 3.217428 • Nested Loops plan with historical average performance per execution of 1.5s, 99th percentile of 3.4s and 95th percentile of 3.2s • 3 Hash-Join plans with average performance in the 40ms to 72ms range • Best performant HJ plan with 40ms on average, and 95th percentile of 54ms
  • 9.
  • 10. Two of the “optimal” HJ plans
  • 11. Case study rules of thumb • Queries are constrained by FETCH FIRST :b ROWS ONLY • If unconstrained, the query were to return many rows, then NL plans may perform better on average than HJ plans • If unconstrained, the query were to return few or no rows, then HJ plans may perform better on average than NL plans • Consistent performance is perceived as more valuable than better performance • Then HJ plans are often the right answer!
  • 12. Candidate indexes for rebuild • Larger than 10 MB • Wasted space of over 25% • They are accessed through a FULL SCAN • As per execution plans in memory or last 7 days of AWR history
  • 13. Exclusions and inclusions • Exclude indexes from a TRANSACTIONS table for which the application performs an explicit LOCK EXCLUSIVE • Regardless of size or wasted space • Include indexes from a TRANSACTIONKEYS table that are known to be the largest on many PDBs • Only if > 10 MB and wasted space > 25%
  • 14. Some large bloated indexes • Not referenced by IFFS or large range scans • Average size of a Tablespace for a PDB is 100 GB • These 4 indexes are usually the largest ones on a PDB • Wasted space for some indexes in the order of 90%
  • 15. Online Index Rebuild Automation • OEM Job executed weekly on every CDB of the fleet • Loop over all PDBs • Loop over all candidate indexes per PDB • Considering thresholds (space and savings) plus exceptions • Execute online index rebuild • Wait 2 minutes between indexes being rebuilt • Log into 3 places • Trace file • Report (spool file) • Alert log
  • 16. Results: sensible space reduction • 130s to 135s per index including 120s between them. Thus ~10s to ~15s per index on average • No visible contention during “eyes-on-glass” on two monitored “online rebuild” cycles of entire fleet • 105 to 142 GB of saved space per CDB on first cycle (including large bloated indexes). Savings ~90%
  • 17. Results: small “overall” performance gain • Real gain is on short-latency queries performing full scans on rebuilt indexes • Performance of IFFS operation is proportional to index size
  • 18. Moving forward • Tune online index rebuild autonomous job • Adjust size (10 MB) and savings (25%) thresholds • Reduce transaction’s retention window • Target: as short as business permits (maybe 2h) • Perform aggressive garbage collection • Implement monitoring job with alarming capabilities • Implement index compression • On leading wide-columns with low to medium cardinality • Evaluate shrinking tables with a new autonomous job • Using online table redefinition
  • 19. Further improvements • Adapt and adopt SPM to achieve plan stability on critical SQL • Implement a smart algorithm based on current and historical performance • Some of the chosen plans will contain IFFS and HJ • Address currently excluded table • Promote EXCLUSIVE TABLE LOCK to a DBMS_LOCK • Improve dynamic SQL eliminating “versioning” subquery • Include ending transaction on each row • Pair Oracle system change number (SCN) to transactions, and use AS OF