arXiv:2608.27758cs.DBAug 2026

Manuscript Offprint

arXiv:2608.27758

Real-time SQL Plan Management in Oracle

Sunil Chakkappen, Mohamed Ziauddin, Hong Su, Shreya Kunjibettu, Nigel Bayliss

Sunil Chakkappen

Oracle America Inc.

Redwood City, CA, USA

sunil.chakkappen@oracle.com

Mohamed Ziauddin

Oracle America Inc.

Redwood City, CA, USA

mohamed.ziauddin@oracle.com

Hong Su

Oracle America Inc.

Redwood City, CA, USA

hong.su@oracle.com

Shreya Kunjibettu

Oracle America Inc.

Redwood City, CA, USA

shreya.kunjibettu@oracle.com

ABSTRACT

Consistent query performance is essential for mission critical database applications, yet SQL execution plans can change due to factors such as database upgrades, DML changes, new indexes, etc. While plan stability mechanisms such as stored outlines prevent regressions by freezing execution plans, they also inhibit performance improvements by disallowing plan evolution. We introduced SQL Plan Management (SPM) in Oracle 11g to address this trade-off by maintaining a set of accepted execution plans and allowing plan evolution only when new plans demonstrably outperform existing baselines. However, prior implementations of SPM primarily rely on background performance verification processes, delaying regression detection and recovery. This issue is amplified in autonomous cloud database systems, where several automatic actions that could cause plan change driven regressions are performed with limited customer control. Timely detection and remediation is paramount, but the constrained background resources on cloud may not keep pace.

To overcome these limitations, we introduce Real-Time SPM in Oracle 26ai, a novel extension of SPM that performs foreground verification of new execution plans during user query execution. Real-Time SPM leverages runtime session context to immediately validate plan changes, enabling rapid adoption of superior plans while promptly detecting and preventing regressions. This paper presents the architecture and design of Real-Time SPM - including technical challenges like reliably comparing performance of previous plans - and contrasts it with traditional background plan evolution. Our experiments highlight tangible benefits of Real-Time SPM - delivering immediate performance boost while preserving plan stability in both cloud-native and on-premise environments. Real-Time SPM is successfully deployed in Oracle production, laying the groundwork for more adaptive and user-responsive SQL plan management in enterprise RDBMS platforms.

PVLDB Reference Format:

Sunil Chakkappen, Mohamed Ziauddin, Hong Su, Shreya Kunjibettu, and Nigel Bayliss. Real-time SQL Plan Management in Oracle. PVLDB, 19(12): 4169 - 4181, 2026.

doi:10.14778/3827998.3828024

Nigel Bayliss

Oracle Global Services Ltd.

Thames Valley, Berkshire, England

nigel.bayliss@oracle.com

1 INTRODUCTION

Oracle-specific SQL Plan Management (SPM) [7] is a preventative mechanism and one of the multi-pronged approaches against performance regressions caused by plan changes. Regressions can be caused by many different reasons like environmental changes, bugs in the software updates, or stale statistics. While there have been numerous robust and adaptive query optimizations proposed [18, 30, 32, 33] - citing cardinality estimation errors as the primary cause of degraded execution plans [21] - these mitigation strategies, like any approach, do not guarantee zero regressions. They also reactively try to correct a plan, or parts of it, when it is found to have degraded performance [35]. Once a regression occurs, it has to be managed, and that is where SPM steps in. SPM addresses plan regressions in a proactive manner [35], enabling the RDBMS Optimizer to automatically manage execution plans, ensuring that the database only uses plans verified to be better. It has three main components:

  • Plan baseline capture - captures and stores relevant information about plans, called SQL plan baselines, for a set of SQL statements.

  • Plan baseline evolution - verifies the performance of existing SQL plan baselines of a statement and marks them as accepted if performance is better compared to other plans for the statement.

  • Plan baseline selection - selects one of the accepted plan baselines for the statement and avoids potential performance regressions.

SPM was introduced in Oracle RDBMS 11g [12, 35]. The whole cycle of plan management was mostly manual, starting with the user loading the SQL statements and their plans into SPM repository. Only plans accepted by the user are considered for execution. Whenever a brand new plan is generated by Cost Based Optimizer (CBO), it is added into SPM repository as a non-accepted plan. The user has to use manual system APIs to evolve a newly added plan by verifying its performance against the baseline performance. If a new plan is accepted, then the CBO starts considering that plan upon next compilation.

In Oracle 12c, Automatic SPM Evolve Advisor [17] was introduced, shifting away from manual work of evolving plan baselines. With this, the verification and evolution of existing plan baselines was automated as a background task triggered by the existing "SQL

This work is licensed under the Creative Commons BY-NC-ND 4.0 International License. Visit https://creativecommons.org/licenses/by-nc-nd/4.0/ to view a copy of this license. For any use beyond those covered by this license, obtain permission by emailing info@vldb.org. Copyright is held by the owner/author(s). Publication rights licensed to the VLDB Endowment.

Proceedings of the VLDB Endowment, Vol. 19, No. 12 ISSN 2150-8097.

doi:10.14778/3827998.3828024

Tuning Advisor" [26] client under the automated database maintenance task framework. This moved the burden of plan performance verification and baseline evolution of existing plan baselines from the user to the system. However, users still had to handle the regressing SQL statements by capturing good plans as SQL Plan Baselines using manual APIs.

Database developers and administrators (DBAs) may be faced with a daunting task dealing with plan changes and regressions resulting from database upgrades/patching or data modifications/new access path structures like indexes in the tables. Since controlled and fully automated plan management systems will be extremely useful in such cases, Automatic SQL Plan Management (Auto SPM) [3] was introduced in Oracle 19c with the goal to provide an automated end-to-end solution to detect and correct regressions for autonomous Exadata environments. Auto SPM relies on another infrastructure component implemented in RDBMS 19 called the Automatic SQL Tuning Set (Auto STS) [8]. Auto STS, described further in section 2.3, periodically captures statements executed in the system and their performance metrics via a background task. Auto SPM was implemented using a background task which runs periodically for up to an internally defined amount of time in which it captures plans as unverified from Auto STS into the SPM repository. Capturing plans into the SPM repository consists of:

(1) looking for multiple plans in Auto STS for a SQL statement

(2) comparing performance metrics (a function of CPU time and Buffer Gets) of best and worst plan

(3) if the best plan performance benefit is above the margin (“regression threshold”) then capture all the plans except for the worst one as non-accepted plan baselines

Auto SPM captures plans for any query that exemplifies significant performance variations from its historical plans. It then verifies the performance of unverified/non-accepted plans, thus creating new accepted plan baselines by evolving non-accepted plans.

However, reliance on background execution introduces several limitations for Automatic SPM, as further discussed in Section 2.4. Background verification was a natural choice for on-premise database systems, but proved to be insufficient for database on cloud. In cloud-managed services, software patches are applied periodically and automatically, often without direct customer involvement. Other automatic actions like Oracle's Automatic Indexing [10] or Automatic Optimizer Statistics Gathering [6] are also performed in autonomous databases. Such actions can introduce plan regressions, yet background verification tasks may not react quickly enough to prevent user-facing performance impact, particularly under constrained resource budgets when resources are shared among different tenants. Background processing also incurs additional resource consumption, increasing operational cost for customers - both on premise and on Cloud. In elastic cloud settings, rapid fluctuations in resource demand can further amplify cost and latency instability in analytical workloads, even under ideal scaling policies [31]. Since background verification is asynchronous with foreground query execution, regression detection and prevention are inherently delayed. Due to the reasons above, such limitations are more prominent on a cloud database compared to the traditional on-premise model.

We introduce Real-Time SPM with the intent to reduce resource usage in the system, and enable automatic SQL plan management on-Cloud on fully managed services in an effective way. A CBO plan that has not yet been accepted can execute in the foreground and have its performance verified during user execution, rather than being deferred to background verification. While newly generated CBO plans are often superior to previously observed plans, if any query exhibits performance regressions, Real-Time SPM reinstates a previously accepted plan and guides the optimizer to avoid the regressed plan in subsequent executions. If the newly generated CBO plan is better in performance, the CBO plan will be used going forward. This approach enables faster detection and resolution of plan regressions, ensures that users benefit from high-performing plans as early as possible, and reduces reliance on background processing by capitalizing on performance metrics collected during Real-Time query execution. Figure 1 summarizes the progression of SPM functionality over Oracle releases.

Figure

Figure 1: SPM Timeline

Section 2 describes Auto SPM in Oracle 19c and its limitations in more detail, followed by the Real-Time SPM solution details in section 3. We provide our experimental results and comparison of Real Time SPM vs Auto SPM in section 4, tying it in with Related Works in section 5 and concluding in section 6.

References (12)