Unix Technical Forum

Count(*) Versus Count(1)

This is a discussion on Count(*) Versus Count(1) within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi, I Read on Many sites about Count (*) and Count(1). But there are conflicts in the documents. Some ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 12:41 PM
Priya
 
Posts: n/a
Default Count(*) Versus Count(1)

Hi,

I Read on Many sites about Count (*) and Count(1). But there are
conflicts in the documents.
Some where it has been specified like count (*) gives better
performance and somewhere it is like Count (1) gives better
performance.

Can anybody please help me to understand how it works and which one is
better for performance?

Any help would be appreciated.

Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 12:41 PM
Vladimir M. Zakharychev
 
Posts: n/a
Default Re: Count(*) Versus Count(1)

On May 3, 9:21 am, Priya <supriyarsh...@gmail.com> wrote:
> Hi,
>
> I Read on Many sites about Count (*) and Count(1). But there are
> conflicts in the documents.
> Some where it has been specified like count (*) gives better
> performance and somewhere it is like Count (1) gives better
> performance.
>
> Can anybody please help me to understand how it works and which one is
> better for performance?
>
> Any help would be appreciated.
>
> Thanks


http://www.oracledba.co.uk/tips/count_speed.htm, Google archives,
numerous other places. To sum up: there are no significant differences
in performance between count(*) and count(1) beyond usual experiment
error, and Oracle does exactly the same amount of work for both.

Regards,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 12:41 PM
William Robertson
 
Posts: n/a
Default Re: Count(*) Versus Count(1)

On May 3, 7:02 am, "Vladimir M. Zakharychev"
<vladimir.zakharyc...@gmail.com> wrote:
> On May 3, 9:21 am, Priya <supriyarsh...@gmail.com> wrote:
>
> > Hi,

>
> > I Read on Many sites about Count (*) and Count(1). But there are
> > conflicts in the documents.
> > Some where it has been specified like count (*) gives better
> > performance and somewhere it is like Count (1) gives better
> > performance.

>
> > Can anybody please help me to understand how it works and which one is
> > better for performance?

>
> > Any help would be appreciated.

>
> > Thanks

>
> http://www.oracledba.co.uk/tips/count_speed.htm, Google archives,
> numerous other places. To sum up: there are no significant differences
> in performance between count(*) and count(1) beyond usual experiment
> error, and Oracle does exactly the same amount of work for both.
>
> Regards,
> Vladimir M. Zakharychev
> N-Networks, makers of Dynamic PSP(tm)
> http://www.dynamicpsp.com


Actually slightly more work for COUNT(1), since the optimizer has to
substitute COUNT(*) internally.

If any document recommends something as idiotic as using COUNT(1)
instead of COUNT(*) I think you can safely disregard any other advice
in that document.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:29 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com