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!

SQL Running Slow!!!

~AnujMohan~Dec 24 2008 — edited Dec 24 2008
A query run by the 'tom' user who searches on (xyz crieteria) takes less than 5 seconds.
However, when the user 'greg' ruuns the same query, it take > 14 minutes to execute for same xyz crieteria.
Note:both are application users and internally use DOCD database user.Both are using same SQL Explain plan but diffrence is disk read in case of long running query.

my question is if both queries are same and using same explain plan and returning same rows why there is disk read???? and such huge diffrence in execution time...Below is the tkprof output for both the queries.

QUICK QUERY
===========

SELECT E_NAME, E_CURVER_NUM, E_CURVER_CKO, E_PROTECTED, E_INA01, E_INA26,
E_INA47, V_FILE_NAME, E_ICON_TITLE, E_INA41, E_INA11, E_INA16, E_INA40,
E_INA15, E_INA35, E_ORG_FILENAME, E_COMMENT, E_INA28, E_INA27,
E_CREATE_DATE, E_OWNER, E_LAST_DATE, V_CHECKED_OUT, V_CHECKIN_USER, V_NAME,
V_E_NAME, V_AVAIL_STAT, V_RECLAIM, V_PERMANENT, V_CSI_STATUS, V_CD, E_INA01,
V_INA03, V_INA02, V_INA04, E_INA02, V_INA01, V_CREATE_DATE, E_INA03
FROM
ELEMENT, VERSION WHERE (NLS_UPPER(E_INA01) LIKE NLS_UPPER(:V001) AND
NLS_UPPER(E_INA26) = NLS_UPPER(:V002) AND E_INA02 IS NULL AND (E_INA03 IS
NULL OR E_INA03 = :V003) AND V_BRANCH_CURVER = :V004) AND ELEMENT.E_NAME =
VERSION.V_E_NAME ORDER BY 12, 10 DESC, 1, 26, 25


call count cpu elapsed disk query current rows



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

--------------------------------------------------------------------------------
Parse 1 0.01 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 167 0.18 0.18 0 29466 0 1002

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

--------------------------------------------------------------------------------
total 169 0.20 0.19 0 29466 0 1002

Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer goal: CHOOSE
Parsing user id: 41

Rows Row Source Operation

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

--------------------------------------------------------------------------------
1002 SORT ORDER BY (cr=29466 r=0 w=0 time=179192 us)
8847 NESTED LOOPS (cr=29466 r=0 w=0 time=146638 us)
14191 TABLE ACCESS FULL VERSION (cr=1082 r=0 w=0 time=25337 us)
8847 TABLE ACCESS BY INDEX ROWID ELEMENT (cr=28384 r=0 w=0 time=97209 us)
14191 INDEX UNIQUE SCAN UI256 (cr=14193 r=0 w=0 time=30388 us)(object id 29956)

SLOW QUERY
==========

SELECT E_NAME, E_CURVER_NUM, E_CURVER_CKO, E_PROTECTED, E_INA01, E_INA26,
E_INA47, V_FILE_NAME, E_ICON_TITLE, E_INA41, E_INA11, E_INA16, E_INA40,
E_INA15, E_INA35, E_ORG_FILENAME, E_COMMENT, E_INA28, E_INA27,
E_CREATE_DATE, E_OWNER, E_LAST_DATE, V_CHECKED_OUT, V_CHECKIN_USER, V_NAME,
V_E_NAME, V_AVAIL_STAT, V_RECLAIM, V_PERMANENT, V_CSI_STATUS, V_CD, E_INA01,
V_INA03, V_INA02, V_INA04, E_INA02, V_INA01, V_CREATE_DATE, E_INA03
FROM
ELEMENT, VERSION WHERE (NLS_UPPER(E_INA01) LIKE NLS_UPPER(:V001) AND
NLS_UPPER(E_INA26) = NLS_UPPER(:V002) AND E_INA02 IS NULL AND (E_INA03 IS
NULL OR E_INA03 = :V003) AND V_BRANCH_CURVER = :V004) AND ELEMENT.E_NAME =
VERSION.V_E_NAME ORDER BY 12, 10 DESC, 1, 26, 25

call count cpu elapsed disk query current rows



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

--------------------------------------------------------------------------------
Parse 1 0.01 0.02 2 2 0 0
Execute 1 0.01 0.00 0 0 0 0
Fetch 167 0.29 1.18 2389 29466 0 1002

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

--------------------------------------------------------------------------------
total 169 0.32 1.21 2391 29468 0 1002

Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer goal: CHOOSE
Parsing user id: 41

Rows Row Source Operation

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

--------------------------------------------------------------------------------
1002 SORT ORDER BY (cr=29466 r=2389 w=0 time=1180072 us)
8847 NESTED LOOPS (cr=29466 r=2389 w=0 time=1144811 us)
14191 TABLE ACCESS FULL VERSION (cr=1082 r=1078 w=0 time=134164 us)
8847 TABLE ACCESS BY INDEX ROWID ELEMENT (cr=28384 r=1311 w=0 time=984455 us)
14191 INDEX UNIQUE SCAN UI256 (cr=14193 r=137 w=0 time=127843 us)(object id 29956)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 21 2009
Added on Dec 24 2008
3 comments
366 views