Re: Priority of profile baseline patch

From: Andy Klock <andy_at_klockmail.com>
Date: Thu, 16 Dec 2021 20:23:31 +0000
Message-ID: <55p-PDX85_zCh_GWlYkGZSUF9bSRVXfGiuixroaemoqVFYuFESjt3o5VTgG9z41X7fpdouFskiI4I_w0bPX7RMa1jhgRNzc0LsEwFIR56tM=_at_klockmail.com>



Hi Laurentiu,

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, December 16th, 2021 at 3:08 PM, Pap <oracle.developer35_at_gmail.com> wrote:

> So in cases where the SQL profile or SQL patch has some hints (say FTS on tab1) which is exactly opposite than that of the one in SQL plan baseline(say index access for tab1). In that scenario will oracle follow profile/patch or the baseline path?

If a cursor has "accepted" baselines, then that is typically what the CBO is going to prefer. When there are multiple accepted plans, then the CBO will pick the plan with the lowest cost. For cursors that also have a SQL Profile, then those hints and opt_estimates are applied which may affect the cost of the baseline plans that the CBO will pick.

Maria wrote a nice article about it [1] in 2012 which I think is still relevant, but often when you have cursors with lots of baselines, SQL Profiles, and patches it's time to fix the stats or change the code :)

Andy K

[1] https://blogs.oracle.com/optimizer/post/what-is-the-difference-between-sql-profiles-and-sql-plan-baselines

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Dec 16 2021 - 21:23:31 CET

Original text of this message