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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: bind vars change explain plan

RE: bind vars change explain plan

From: Thomas, Kevin <Kevin.Thomas_at_calanais.com>
Date: Mon, 22 Jul 2002 07:48:29 -0800
Message-ID: <F001.0049DC61.20020722074829@fatcity.com>


Your colleague hit the nail on the head.

Using bind variables in queries can give the database a "hit or miss" approach to
whether or not it uses indexes. Something to do with how skewed the indexes are also.

Regards,
Kev.

-----Original Message-----
Sent: 22 July 2002 16:08
To: Multiple recipients of list ORACLE-L

prem.
Never did get an answer to this question. I don't know why using bind variables changed the execution path. My best guess comes from the developer. She thinks that when we supplied the values, the optimizer knew what the range of values would be, and could therefore determine to use the index. With the bind variable, the optimizer did not have a range of values to work with and therefore did not choose the index in the execution path.

I have no knowledge that using bind variables will suppress indexes. Just happened that it did in this case.
Also keep in mind that this particular database is using an old version of Oracle (7.3.4). Optimizer got much better in version 8.

The list helped me out with a work-around, which was to index-hint the index I wanted.

Bind variables are definitely "good guys". I highly recommend you continue with your code changes to include binds.

Good luck.
Barb

> ----------
> From: oraora oraora[SMTP:oraoraora_at_rediffmail.com]
> Reply To: oraora oraora
> Sent: Sunday, July 21, 2002 8:24 PM
> To: bbaker_at_denvernewspaperagency.com
> Subject: Re: bind vars change explain plan
>
> Baker,
>
> sorry i did not read the reply to ur query.
> what was the reply ?
> will using bind vars suppress index ?
> kindly let me know b'coz i have also changed my code to SQL with
> bind vars just now.
>
> Regards,
> prem.
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Baker, Barbara
  INET: bbaker_at_denvernewspaperagency.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Thomas, Kevin
  INET: Kevin.Thomas_at_calanais.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jul 22 2002 - 10:48:29 CDT

Original text of this message

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