Professional Documents
Culture Documents
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
DATABASE
ORACLE RAC
GOLDENGATE
DB SCRIPTS
HOW TO
FORUM
11
DATABASE SCRIPTS
18
DATAGUARD
GOLDENGATE
HOW TO
17
ORACLE 12C
17
ORACLE RAC
ORACLE SECURITY
PERFORMANCE
TUNING
TROUBLESHOOTING
13899072
Elapsed: 00:00:17.29
how to use
DBMS_PRIVILEGE_CAPTURE
to capture privs in oracle
12c
164 0
1/9
8/30/2015
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
Note
---- - dynamic sampling used for this statement (level=2)
26 rows selected.
Elapsed: 00:00:00.03
How to configure
manager process in
golden gate 11g
52 0
42 0
Elapsed: 00:00:00.05
Email *
Subscribe to our
Newsletter
http://dbaclass.com/index.php/article/changetheexecutionplanwithoutchangingthesqlquery/
2/9
8/30/2015
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
Elapsed: 00:00:00.01
We can see two plans got loaded. Lets disable these existing
plans.
Elapsed: 00:00:00.05
09:42:49 SQL > exec :cnt := dbms_spm.alter_sql_plan_baseline
plan_name = >
attribute_name
attribute_value
Elapsed: 00:00:00.01
09:43:02 SQL > select sql_handle,sql_text,plan_name,enabled
from
dba_sql_plan_baselines
where
sql_text like '%bigtab%';09:43:05 209:43:05 309:43:
SQL_HANDLE SQL_TEXT
------------------------------ ---------------------------SQL_a868c91ef7af57ad select count(*) from bigtab
tab)
Elapsed: 00:00:00.01
Lets run the the same query with parallel hint and get the
execution plan.
09:33:37 SQL > select /*+ parallel (4) */ count(*) from bigtab
13899072
Elapsed: 00:00:07.41
09:33:57 SQL > select * from table (dbms_xplan.display_cursor
SQL_IDgq322uk9152yg, child number 0
http://dbaclass.com/index.php/article/changetheexecutionplanwithoutchangingthesqlquery/
3/9
8/30/2015
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
Note
---- - dynamic sampling used for this statement (level=2)
- Degree of Parallelism is 4 because of hint
38 rows selected.
Elapsed: 00:00:00.02
So for the query with parallel hint, you can get these two details
from the above execution plan.
SQL ID: gq322uk9152yg
Plan hash value: 1244248794
Now load these two values to the existing sql handle id
SQL_a868c91ef7af57ad
4/9
8/30/2015
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
where
sql_text like '%bigtab%';09:43:05 209:43:05 309:43:
SQL_HANDLE SQL_TEXT
------------------------------ ---------------------------SQL_a868c91ef7af57ad select count(*) from bigtab
tab)
Elapsed: 00:00:00.01
Elapsed: 00:00:00.06
SQL_HANDLE SQL_TEXT
------------------------------ ---------------------------SQL_a868c91ef7af57ad select count(*) from bigtab
tab)
Elapsed: 00:00:00.01
We can see a new plan has been enabled for this sql. This is the
parallel hinted plan.
Lets check the explain plan of the orginal query and verify
whether it is using the parallel hinted execution plan or not.
5/9
8/30/2015
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
COUNT(*)
---------13899072
Elapsed: 00:00:10.98
09:51:25 SQL > explain plan for
09:51:32 2 select count(*) from bigtab where weight in
Explained.
Elapsed: 00:00:00.03
09:51:35 SQL > select plan_table_output from
table(dbms_xplan.display('plan_table',null,'typical -cost -bytes'
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------Plan hash value: 1244248794
Note
---- - Degree of Parallelism is 4 because of hint
- SQL plan baseline "SQL_PLAN_ahu693vvuypxd6e73d422" used
30 rows selected.
Elapsed: 00:00:00.03
http://dbaclass.com/index.php/article/changetheexecutionplanwithoutchangingthesqlquery/
6/9
8/30/2015
changetheexecutionplanwithoutchangingthesqlqueryDBACLASSDBACLASS
PERFORMANCE TUNING
About admin
View all posts by admin
Related Articles
How to export and import statistics in oracle
Gather stats and Publish them later in oracle
Get explain plans of a sql query from AWR using
DBMS_XPLAN.DISPLAY_AWR
Leave a Reply
Your email address will not be published. Required fields are marked
*
Name *
Email *
Website
http://dbaclass.com/index.php/article/changetheexecutionplanwithoutchangingthesqlquery/
7/9