Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Why SQL plan baseline is not even considered for a statement?

Eugene HryzDec 20 2024

I want to create a SQL baseline for a very simple statement in Oracle 11g. But the created baseline is not even considered. In the resulting plan there is even no 'Note' section, that would say that it failed to use SQL plan baseline.

So I have the following statement:

select * from A.some_table where id = 1345;

I find the SQL_ID of this statement and then load the plan into a baseline:

DECLARE
    cnt NUMBER;
BEGIN
    cnt := sys.dbms_spm.load_plans_from_cursor_cache(sql_id=>'c81xtthmbvhfr');
END;

I confirm that the baseline was created using the following query (the plan is enabled and accepted):

SELECT b.* FROM dba_sql_plan_baselines b, v$sql s
WHERE  s.sql_id='c81xtthmbvhfr' AND s.exact_matching_signature = b.signature;

Then I flush the shared pool and execute the statement again, but the resulting plan says nothing about sql plan baselines in the Note section. When I generated trace [SQL_Compiler.*] trace, it had this: `SPM: current statement disallowed`

The parameter optimizer_use_sql_plan_baselines is set to true. And also the database is in RAC environment. Need help to understand why the plan baselines are not considered

Thanks!

Comments

Post Details

Added on Dec 20 2024
8 comments
402 views