Re: Oratcl Bind Queries

From: Adrian Bowen (raptor_at_gotadsl.co.uk)
Date: 06/08/04


Date: Tue, 8 Jun 2004 20:13:07 +0100


"Miguel Ba??n" <spanmeifyoucan@hotmail.com> wrote in message
news:892a12e7.0406081010.e66a95a@posting.google.com...
> "Adrian Bowen" <raptor@gotadsl.co.uk> wrote in message
news:<40c554ce$0$6330$65c69314@mercury.nildram.net>...
> > Hi Damon,
> >
> > I don't know if this is the cause of the problem you're seeing or not,
but
> > the use of bind variables can, I believe, radically alter the execution
plan
> > that Oracle uses for a given query, specifically when the cost based
> > optimiser (CBO) is used.
>

<snip>

> So would you suggest not to use bind variables as a general rule?

Well, I am not an Oracle expert by any means, but I think the general
consensus is that one should *always* use bind variables wherever possible
to avoid the overhead of hard parses, and to allow as many queries and
execution plans as possible to be cached efficiently in the SGA.

However, unless Oracle 9 or Oracle 10 have significantly improved the way
the CBO works, you will need to manually 'hint' the query plan for these
queries, based on your a priori knowledge of the value distributions in the
tables you are joining. In practice this is fairly simple, you just let
Oracle know (by way of the hints) which order to do the joins in so as to
reduce the number of rows being considered as quickly as possible.

As I said, this may not be the cause of the problem you are seeing, but it
is a possibility.

Adrian



Relevant Pages

  • Re: IBM 10year plan for Informix
    ... the Oracle consultants is saying that IBM have no plan for Informix. ... And IBM uses the same tactic. ...
    (comp.databases.informix)
  • Re: Append Bypass_recursive_check
    ... particular hint. ... Also the version of Oracle. ... transformation and temp table transformation ... and your are expecting your queries to do ...
    (comp.databases.oracle.server)
  • Re: Slow SQL, too many logical reads ?
    ... A_INDACT columns referenced in the where-clause. ... by DBMS_XPLAN setting that seems to return the same plan ... Oracle selected a very unselective index. ... Then, I tried modified the query, removing the IA.IA_SEQUE from the ...
    (comp.databases.oracle.server)
  • Re: default select order
    ... Now I'm wondering why 10g2 works like this (every time I query)? ... returned they should be coded with an ORDER BY clause ... ... guarantee from oracle that it won't change order otherwise. ... Plan hash value: 403654761 ...
    (comp.databases.oracle.server)
  • Re: simple star transformation problem
    ... > My main issue is the plan Oracle is using for this query. ... > which looks a lot better (no nested loops etc) and execution time drops ...
    (comp.databases.oracle.server)