Re: delete performance from a standalone sql versus the same call from a procedure

From: Tim X <timx_at_nospam.dev.null>
Date: Sat, 14 Nov 2009 17:33:32 +1100
Message-ID: <873a4hty2r.fsf_at_lion.rapttech.com.au>



z1hou1 <z1hou1_at_gmail.com> writes:

> Hi,
>
> Database Oracle 10.2.0.4 running on Sun Solaris.
>
> I am facing a peculiar issue. I have a package with a procedure that
> handles deletes off a particular table. The delete runs in sub seconds
> for about 10000 rows when I execute it standalone from sqlplus. But
> the very same statement from inside a stored procedure (of the
> package) indicates a full table scan and takes forever to run.
>
> What is it that I may be doing that causes the very same delete to run
> with different plans from a stored procedure as opposed to an
> anonymous sql block?
>
> Thanking you all for your response.
>
> Regards,

You probably need to show us both the procedure and the "anonymous SQL block" (which in itself is a little confusing - if its just a delete, why is it in a anonymous block or do you mean just SQL executed at the sqlplus prompt).

Often, what appears to be equivalent SQL isn't really equivalent. Are you using bind variables? Are you using parameters in one and not the other, does one use a function and the other doesn't in a where clause etc etc.

Tim

-- 
tcross (at) rapttech dot com dot au
Received on Sat Nov 14 2009 - 00:33:32 CST

Original text of this message