Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Similiar SQL statement, performance improve?
A copy of this was sent to Jimmy <c6635500_at_comp.polyu.edu.hk> (if that email address didn't require changing) On Fri, 13 Mar 1998 20:19:04 -0800, you wrote:
>Hello all,
>
> I know that a SQL statement is stored in the shared pool of the SGA
>once a statement is executed. The purpose is to improve the performace
>when the same SQL statement execute again.
>
> If SQL statement1 is : "select * from table1 where table1.att =
>'TEMP1'"
> and sumbitted to Oracle to execute.
>
> Then another SQL statement2 : "select * from table1 where table1.att =
>'TEMP2'"
>
> I want to ask, is statement2 gain the improvement after statement1 is
>executed?
>
>Thanks,
>Jimmy
No, you must use bind variables to achieve the advantages of the shared pool in your case.
Given the 2 queries:
They are different, they are not shared -- case is different.
Given the 2 queries:
They are different, they are not shared.
Given the 2 queries:
They are the same, they will reuse the query plans/parse trees, etc. Even if you vary the inputs to :1, they will be reused (the plans, not the outputs)...
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Mar 13 1998 - 00:00:00 CST