dbTalk Databases Forums  

execution plans

comp.databases.oracle.server comp.databases.oracle.server


Discuss execution plans in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
geos
 
Posts: n/a

Default execution plans - 10-18-2011 , 03:02 PM






there is a query which executes with two different plans when run on
different accounts. this is generally understandable to me. but is there
a way/algorithm to investigate the settings/configuration/permissions
which have crucial influence on execution plans? for example:

select * from emp where ename in ('KING','SMITH');

execution plan as scott:
0 SELECT STATEMENT, koszt 24
1 COLLECTION ITERATOR PICKLER FETCH

execution plan as sys:
0 SELECT STATEMENT, koszt 2
1 INLIST ITERATOR
2 TABLE ACCESS BY INDEX ROWID
3 INDEX RANGE SCAN

is there anything in the above plans that suggests some parameter(s)
which when set in sys session would give scott-like execution plan?

thank you,
geos

--
FUT: comp.databases.oracle.misc

Reply With Quote
  #2  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: execution plans - 10-18-2011 , 06:29 PM






On Tue, 18 Oct 2011 22:02:01 +0200, geos wrote:

Quote:
execution plan as scott:
0 SELECT STATEMENT, koszt 24
1 COLLECTION ITERATOR PICKLER FETCH
Geos, this is the execution plan for
"select * from table(dbms_xplan.display_cursor())"

You've made a mistake somewhere. Let me demonstrate:

[mgogala@medo ~]$ sqlplus scott/tiger

SQL*Plus: Release 11.2.0.3.0 Production on Tue Oct 18 19:25:26 2011

Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing
options

SQL> select * from emp where ename in ('KING','SMITH');

EMPNO ENAME JOB MGR HIREDATE SAL COMM
---------- ---------- --------- ---------- --------- ---------- ----------
DEPTNO
----------
7839 KING PRESIDENT 17-NOV-81 5000
10

7369 SMITH CLERK 7902 17-DEC-80 800
20


Elapsed: 00:00:00.07
SQL> select * from table(dbms_xplan.display_cursor());

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID gz5n0raq2znm5, child number 0
-------------------------------------
select * from emp where ename in ('KING','SMITH')

Plan hash value: 3225201695

--------------------------------------------------------------------------------
----------

Quote:
Id | Operation | Name | Rows | Bytes | Cost (%
CPU)|
Time |

--------------------------------------------------------------------------------
----------

Quote:
0 | SELECT STATEMENT | | | | 2
(100)|


1 | INLIST ITERATOR | | |
|


2 | TABLE ACCESS BY INDEX ROWID| EMP | 2 | 74 |
2 (0)|
00:00:01 |

Quote:
* 3 | INDEX RANGE SCAN | EMP_ENAME | 2 | |
1 (0)|
00:00:01 |

--------------------------------------------------------------------------------
----------


Predicate Information (identified by operation id):
---------------------------------------------------

3 - access(("ENAME"='KING' OR "ENAME"='SMITH'))

Note
-----
- SQL plan baseline SQL_PLAN_8dv7sf1yt16ycb03ea9f1 used for this
statement


24 rows selected.

Elapsed: 00:00:01.25
SQL> select * from table(dbms_xplan.display_cursor());

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID 738a0r0utp4wv, child number 0
-------------------------------------
select * from table(dbms_xplan.display_cursor())

Plan hash value: 3713220770

--------------------------------------------------------------------------------
--------------------

Quote:
Id | Operation | Name | Rows |
Bytes | Cos
t (%CPU)| Time |

--------------------------------------------------------------------------------
--------------------

Quote:
0 | SELECT STATEMENT | |


24 (100)| |

Quote:
1 | COLLECTION ITERATOR PICKLER FETCH| DISPLAY_CURSOR | 8168 |
16336 |
24 (5)| 00:00:01 |

--------------------------------------------------------------------------------
--------------------


Note
-----
- SQL plan baseline SQL_PLAN_bgbyxyzjz83xz8df50001 used for this
statement


17 rows selected.

Elapsed: 00:00:00.06
SQL>


First, I executed your SQL and then executed dbms_xplan.display_cursor
twice. Second time, it gave me the plan that seems to be the problem.


--
http://mgogala.byethost5.com

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.