Thanx Frank for the correction. I now remember that it was in a Google
thread that I saw this. But as Tom Kyte mentioned on the thread you
quote, it used to be that select count(*) and select count(1) were
treated differently, in versions 7 and lower. That's probably why I
saw that comment on an old Google thread about how differently they're
treated.
Daniel
Daniel Roy wrote:
>
NO!
Actually Tom wrote:
"Prove it, give me that test case. You are wrong.
COUNT(*) and COUNT(1) are the *same* -- the same -- the same -- no
different, the same.
count(1) is internally optimized to count(*) "
>
And he posted the explain plans for count(*) and count(1).
I read somewhere (asktom?) that "select count(1) from table" is
internally rewritten as "select count(*) from (select 1 from table)",
and therefore just adds some overhead.
Daniel
gelangov@hotmai l.com (Geetha) wrote in message news:<4b40e20a. 0310290724.13e8 6079@posting.go ogle.com>...
internally rewritten as "select count(*) from (select 1 from table)",
and therefore just adds some overhead.
Daniel
gelangov@hotmai l.com (Geetha) wrote in message news:<4b40e20a. 0310290724.13e8 6079@posting.go ogle.com>...
>I searched in the Oracle documents what count (1) meant and I could
>not find an answer. Can some one explain what Oracle does internally
>when use count (1) VS count (*). Thank you very much in advance! We
>use Oracle 9i.
>not find an answer. Can some one explain what Oracle does internally
>when use count (1) VS count (*). Thank you very much in advance! We
>use Oracle 9i.
NO!
Actually Tom wrote:
"Prove it, give me that test case. You are wrong.
COUNT(*) and COUNT(1) are the *same* -- the same -- the same -- no
different, the same.
count(1) is internally optimized to count(*) "
>
And he posted the explain plans for count(*) and count(1).
Leave a comment: