Skip to Main Content
  • Questions
  • sql plan management - difference in defining parameters at system and session level

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, sathiya.

Asked: November 13, 2018 - 1:44 pm UTC

Last updated: November 15, 2018 - 2:52 pm UTC

Version: 12c

Viewed 1000+ times

You Asked

Hi Tom,

I am very new to performance tuning.
there's something that I am unclear about sql plan management.

which one is faster -

1. setting OPTIMIZER_CAPTURE_SQL_PLAN_BASELINE to TRUE at session level (inside function body) and OPTIMIZER_USE_SQL_PLAN_BASELINES to TRUE at system level.


2.setting both to TRUE at system level

3. setting both to TRUE at session level.

and Chris said...

Setting OPTIMIZER_CAPTURE_SQL_PLAN_BASELINES to true tells the database to store plans for repeatable SQL queries. i.e. those that run more than once.

Once the database has captured a plan for a query, this forms the baseline. Future queries will use this plan (and only this plan) if OPTIMIZER_USE_SQL_PLAN_BASELINES is true.

The system level settings define the defaults for every session.

The session level settings override the system level settings for that particular session.

So it's not really a question of which is "faster". More how you want the system to behave.

Read more about this at:

https://www.oracle.com/technetwork/database/bi-datawarehousing/twp-sql-plan-mgmt-12c-1963237.pdf

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Performance

Get all the information about database performance in the Database Performance guide.