Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: When optimizer reevaluate SQL statement
In response to:
"I'm afraid I can't agree with the statement that two different users submitting the same SQL cause a hard parse."
I tried the following tests to confirm my comments. Following through some simple SQL, the results are obvious.
Connected to Oracle8i Enterprise Edition Release 8.1.6.3.0 Connected as sys
SQL> create user test1 identified test1 default tablespace users temporary tablespace temp;
User created
SQL> create user test2 identified by test2 default tablespace users temporary tablespace temp;
User created
SQL> grant connect, resource to test1, test2;
Grant succeeded
SQL> grant plustrace to test1, test2;
Grant succeeded
SQL> create table test1.employee as select * from cspence.employee sample(.5);
Table created
SQL> create table test2.employee as select * from cspence.employee sample(.5);
Table created
SQL> connect test1/test1_at_jetfuel
Connected to Oracle8i Enterprise Edition Release 8.1.6.3.0
Connected as test1
select *
from employee
where emp_id = 5
/
Hard Parse Count: 1
select *
from employee
where emp_id = 5
/
Hard Parse Count: 0
SQL> connect test2/test2_at_jetfuel
Connected to Oracle8i Enterprise Edition Release 8.1.6.3.0
Connected as test2
select *
from employee
where emp_id = 5
/
Hard Parse Count: 1
select *
from employee
where emp_id = 5
/
As they say, the proof is in the pudding.
I use PL/SQL Developer, and didn't use "Auto trace" as the "PlusTrace" role may have implied.
Hope this helps clarify things.
"Do not criticize someone until you walked a mile in their shoes, that way when you criticize them, you are a mile a way and have their shoes."
Christopher R. Spence
Oracle DBA
Phone: (978) 322-5744
Fax: (707) 885-2275
Fuelspot
73 Princeton Street
North, Chelmsford 01863
-----Original Message-----
Sent: Sunday, September 23, 2001 10:45 AM
To: Multiple recipients of list ORACLE-L
I'm afraid I can't agree with the statement that two different users submitting the same SQL cause a hard parse. It is my understanding of the process that part of the parsing occurs when another user is submitting an identical SQL statement, but this does not constitute a hard parse, just a check of permissions, synonyms, etc. If there was a hard parse everytime a different user submitted identical SQL it would negate much of the benefit of using bind variables. Thus the answer is that there is reparsing, but not the kind that really does damage to performance.
Regards,
Chris Gait
On 14 Sep 2001, at 9:55, Christopher Spence wrote:
Date sent: Fri, 14 Sep 2001 09:55:33 -0800 To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Send reply to: ORACLE-L_at_fatcity.com Organization: Fat City Network Services, San Diego, California
> !! Please do not post Off Topic to this List !!
>
> If the Oracle executing user is different, the execution plan will be
> different due to possibility of different objects and security.
>
> Different sessions under the same user can share using bind variables.
>
> "Do not criticize someone until you walked a mile in their shoes, that way
> when you criticize them, you are a mile a way and have their shoes."
>
> Christopher R. Spence
> Oracle DBA
> Phone: (978) 322-5744
> Fax: (707) 885-2275
>
> Fuelspot
> 73 Princeton Street
> North, Chelmsford 01863
>
>
>
> -----Original Message-----
> Sent: Friday, September 14, 2001 12:25 PM
> To: Multiple recipients of list ORACLE-L
>
> !! Please do not post Off Topic to this List !!
>
> Chris:
>
> > If you are executing it under a different user the statement will be
> reparsed.
>
> I'm puzzled. I always thought that different users submitting the
identical
> SQL statement would use the same plan and not need to be reparsed. I
> understood that to be part of the reasoning behind bind variables and the
> big advantage of cursor sharing. Please explain.
>
> Jon Walthour
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Walthour, Jon (GEAE, Compaq)
> INET: Jon.walthour_at_ae.ge.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Christopher Spence
> INET: cspence_at_FuelSpot.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: cjgait_at_earthlink.net Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Christopher Spence INET: cspence_at_FuelSpot.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Oct 03 2001 - 14:44:08 CDT