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: Incorrect cardinality estimate

Re: Incorrect cardinality estimate

From: Alberto Dell'Era <alberto.dellera_at_gmail.com>
Date: Thu, 25 Jan 2007 22:26:15 +0100
Message-ID: <4ef2fbf50701251326m55bcfae9x2e704b5f053ba5ca@mail.gmail.com>


Comments embedded.

On 1/25/07, Baumgartel, Paul <paul.baumgartel_at_credit-suisse.com> wrote:
> I'm enjoying the discussion this has prompted.
>
> Just for fun, I re-created the column histogram, this time adding cascade=>true (hadn't done that before).
(snip)
> For the column, density is .006292113.
>
> Now, wonder of wonders, I am getting the (different) optimizer plans I want for non-popular
> (492 rows) and popular (2143642 rows) values of ODS_PROCESS_DATE. 10053 trace
> shows that, for non-popular value, optimizer estimates cardinality to be 1223485, but
> calculates cost of single-index lookup (desired path) to be just slightly less than the cost
> of the index join. For the popular value, cardinality is computed to be 2296622, and the
> index hash join in chosen.

I think you're simply getting lucky - the cardinality estimation has not changed,
but with the proper index statistics in place, the hugely wrong 1223485 instead of
the correct 492 is still low enough to favor the index access.

Obviously - a small change in the data distribution may easily increase the wrong 1223485 estimation over the "index is better" threshold ;)

-- 
Alberto Dell'Era
"Per aspera ad astra"
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Jan 25 2007 - 15:26:15 CST

Original text of this message

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