Re: CBO Predicate selectivity

  • From: "Alex Gorbachev" <gorbyx@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 13 Jul 2006 10:30:37 +0200

I didn't see which Oracle version it is but if it's 10g than SQL
Profile might be the good choice.

Until 10g, the optimizer does not peek at values for this
query - it uses the standard col >/< :bind algorithms which
basically means the predicate has a selectivity of 0.25%
(5% of 5%).

> - "where date between to_date(:b1) and to_date(b2)"


You say you can't change the query, so if you want to fake this query, you probably need to use dbms_stats.set_table_stats to tell Oracle that the table has a very small number of rows - but don't change the block count - so that a properly calculated selectivity is fooled into getting the right cardinality. Then capture the execution plan in a stored outline - and put the stats back to normal.

-- Best regards, Alex Gorbachev

http://blog.oracloid.com
--
//www.freelists.org/webpage/oracle-l


Other related posts: