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: Index Not Used with Parameterized Query

Re: Index Not Used with Parameterized Query

From: srivenu <srivenu_at_hotmail.com>
Date: 30 Dec 2003 23:14:29 -0800
Message-ID: <1a68177.0312302314.5a664c97@posting.google.com>


biff,
The default selectivity used by the CBO for like predicates with bind variables is high which is causing a full table scan in your case. The default selectivity used by the CBO, for the clause "I.COL2 LIKE :LastName" is 5% and the optimizer may not use the index depending on several other factors like other predicates in the query, clustering factor of the index etc.
To reduce the selectivity of this set the parameter "_like_with_bind_as_equality"=TRUE.
This will cause the CBO to estimate the selectivity of the clause "I.COL2 LIKE :LastName" the same as the clause "I.COL2 = :LastName". The selectivity of the clause "I.COL2 = :LastName" is calculated by the formulae
1/(Number of Distinct Values for I.COL2). So try setting "_like_with_bind_as_equality"=TRUE and see the result. regards
Srivenu Received on Wed Dec 31 2003 - 01:14:29 CST

Original text of this message

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