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: Use of sys_context changes execution plan

Re: Use of sys_context changes execution plan

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 5 Jul 2002 17:47:07 +0100
Message-ID: <1025887961.27349.0.nnrp-14.9e984b29@news.demon.co.uk>

You've probably answered your own question.

>sys_context ( in order to make use of bind variables )

Bind variables are generally of unknown value at optimisation time, so may cause the path to change, especially if your query involves a range operator.

There is also the problem that sys_context() returns a character value, so perhaps you are also being caught by an unexpected coercion effect.

For comparative purposes, try getting an execution path (from explain plan) using things like :n instead of the literals, this may give you an idea of what the path would be with sys_context().

--
Jonathan Lewis
http://www.jlcomp.demon.co.uk

Next Seminars
        UK            July / Sept
        Australia      July / August
        Malaysia        September
        USA (MI)        November
http://www.jlcomp.demon.co.uk/seminar.html

Paul Ansell wrote in message ...

>I have a dynamically generated query which when executed with
>hard-coded where clause values uses an execution plan that I am happy
>with. However, when I replace the hard-coded values with calls to
>sys_context ( in order to make use of bind variables ) a different,
>inferior execution plan is chosen. Any ideas why this should happen?
Received on Fri Jul 05 2002 - 11:47:07 CDT

Original text of this message

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