RE: Count function

RE: Count function

 

  

Hi,
See below test. Count(*) is slowest by a large degree. Count of
constant is the fastest, count of pseudocolumn just slightly slower.
-Paul

Connected to Oracle9i Enterprise Edition Release 9.2.0.4.0

SQL> select count(*) from temp1;

COUNT(*)
----------
125222

Executed in 0.844 seconds

SQL> select count(1) from temp1;

COUNT(1)
----------
125222

Executed in 0.141 seconds

SQL> select count(rowid) from temp1;

COUNT(ROWID)
------------
125222

Executed in 0.188 seconds

-----Original Message-----
From: Mahapatra Himanshu (*IC)
[mailto:oracledba-ezmlmshield-x88730386.[Email address protected]
Sent: Thursday, September 06, 2007 9:54 AM
To: LazyDBA Discussion
Subject: RE: Count function

Count(2) will be faster as it does not need to read the entire block, as
"2" is a constant.

Thanks & Regards,
Himanshu Mahapatra

-----Original Message-----
From: Dindy Paul
[mailto:oracledba-ezmlmshield-x88365709.[Email address protected]
Sent: 06 September 2007 14:50
To: LazyDBA Discussion
Subject: RE: Count function

There is no difference.
There was a discussion recently where it seemed as if using count(rowid)
was a bit faster than other methods.
Paul D.

-----Original Message-----
From: Ajay Kumar Jindal
[mailto:oracledba-ezmlmshield-x7807713.[Email address protected]
Sent: Thursday, September 06, 2007 7:10 AM
To: LazyDBA Discussion
Subject: Count function

Dear All,

can anybody tell me what is the difference betweeen count(*) and
count(2)


Regards,
Ajay Jindal


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and privileged information or otherwise protected by law.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy all copies of the original message.


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html




CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

Oracle LazyDBA home page