Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Block Query Slow

Re: PL/SQL Block Query Slow

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 15 Aug 2005 14:03:04 -0700
Message-ID: <1124139784.896473.110040@z14g2000cwz.googlegroups.com>


Brijesh, the two queries are not actually the same query. One is using bind variables (pl/sql variables) while the other is using constants. It is very likely the CBO is developing different plans for the two versions since it has the actual constant values in one case and unknown values in the other.

Run an explain plan on both versions. You can use :var1, :v2 to represent bind variables in explain plan.

Also the pl/sql version is processing each and every row in the cursor while the straight query just returns the entire row set. This is a very significant difference in the two statements.

Explain plans for each version of the query may allow someone to provide useful advice.

HTH -- Mark D Powell -- Received on Mon Aug 15 2005 - 16:03:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US