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

Home -> Community -> Usenet -> c.d.o.server -> Re: Slow query when using parameters

Re: Slow query when using parameters

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/03/31
Message-ID: <954491742.3985.0.pluto.d4ee154e@news.demon.nl>#1/1

Most likely you are using the cost based optimizer. When you use a hardcoded literal, the optimizer uses the datadictionary statistics to verify how often your key occurs. When you use a bind variable, the optimizer can't perform this check. However, when you use a literal, you force the optimizer to parse your query, when while using the bind-variables the query will be simply reopened.
I can't decide for you how big the tradeoff associated is, and without any details on the query I also can't advise on how to circumvent this problem, other than comparing explain plans, and forcing the optimizer with hints to use the 'hardcoded' access-path.

Hth,

Sybrand Bakker, Oracle DBA

<pmartin_at_mitsa.ch> wrote in message news:8c1m45$kg$1_at_nnrp1.deja.com...
> Hello
>
> I've got a performance problem with a query.
> The query is in a procedure in a package (although this seems to make
> no difference).
>
> The parameters for the query are passed as arguments to the procedure.
>
> With the parameters passed as arguments the query takes 1 minute 40
> seconds to run. However if I 'hardcode' the paramter values the query
> only takes 11 seconds to run.
>
> I've tried putting the parameters passed to the stored procedure
> into local variables and then use the local variables in the query but
> this doesn't change anything.
>
> Can anybody explain this difference ?
>
> Many thanks
>
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Fri Mar 31 2000 - 00:00:00 CST

Original text of this message

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