Re: count(*) ?
Date: Wed, 16 Jan 2008 09:57:19 +0100
Message-ID: <478dc6f7$0$85795$e4fe514c@news.xs4all.nl>
"shakespeare" <whatsin_at_xs4all.nl> schreef in bericht
news:478dc26c$0$85794$e4fe514c_at_news.xs4all.nl...
>
> "shakespeare" <whatsin_at_xs4all.nl> schreef in bericht
> news:478dc155$0$85778$e4fe514c_at_news.xs4all.nl...
>>
>> "Frank van Bortel" <frank.van.bortel_at_gmail.com> schreef in bericht
>> news:7767f$478cff47$524b5c40$12171_at_cache5.tilbu1.nb.home.nl...
>>> nick wrote:
>>>> I understand that when you feed the count( ) function an asterisk as
>>>> an argument it runs
>>>> slower than if you use a column name as an argument. Can someone tell
>>>> me why this is so?
>>>>
>>>> Thanks
>>> Test it - it is not so - who do you believe?!?
>>>
>>> --
>>>
>>> Regards,
>>> Frank van Bortel
>>>
>>> Top-posting in UseNet newsgroups is one way to shut me up
>>
>> O yes it is! If you have a sparse column (say col_a), indexed in a very
>> large table, count(col_a) will use the index , where count(*) doesn't
>> (and they will return different values as well).
>> I think you confused this with select (*) and select (1) (which perform
>> the same, although you might find a DBA at your current working place who
>> is convinced that count (8) is faster.....). They ARE not the same
>> though, for count(*) from table in a view will not invalidate a view when
>> a column is added to the table, where count(1) will.....
>>
>> Shakespeare
>>
>
> mmm I must correct that, both views become invalid. Have seen examples of
> the contrary, will look them up and report....
>
>
> Shakespeare
>
Got it.... in the pythian blogs:
http://www.pythian.com/blogs/627/oracle-11g-unexpected-difference-between-count-and-count1
and seems to be an 11g issue, does not reproduce in my 10g database.
Shakespeare Received on Wed Jan 16 2008 - 02:57:19 CST