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: Difference between count(1) and count(*)

RE: Difference between count(1) and count(*)

From: Mitchell Baldwin <Mitchell.Baldwin_at_cogent-dsn.com>
Date: Thu, 8 Jul 2004 15:51:49 +0100
Message-ID: <A5E49A0595FB4A489ED566217349B1472DBAFF@zaphod1.cogent-dsn.local>


I thought we all agreed years ago that the optimizer is aware of = Count(*) ?..

-----Original Message-----
From: Srinivasan Vasan [mailto:Vasan.Srinivasan_at_churchill.com] Sent: 08 July 2004 15:38
To: 'oracle-l_at_freelists.org'
Subject: RE: Difference between count(1) and count(*)

Is this a difference between RBO and CBO? I am on CBO on 9.2.0.5 and my timings are similar to Mladen's - i.e., almost the same for all types of counts.

Cheers,=20

Vasan.
-----Original Message-----
From: Mladen Gogala [mailto:mladen_at_wangtrading.com]=20 Sent: 08 July 2004 15:32
To: oracle-l_at_freelists.org
Subject: Re: Difference between count(1) and count(*)

On 07/08/2004 09:40:17 AM, Peter Miller wrote:
> 1,749,951 rows returned in every case

>=20

> count(rowid) - approx 3.2 secs
> count(obj#) - approx 3.5 secs
> count(1) - approx 3.6 secs
> count(*) - approx 3.6 secs
> count(rownum)- approx 4.6 secs
> count(source)- approx 8.6 secs

>=20

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production With the Partitioning option
JServer Release 9.2.0.5.0 - Production
=20
SQL> set timing on
SQL> select count(*) from wi_cumulative; =20
  COUNT(*)



  12148659
=20
Elapsed: 00:00:20.16
SQL> select count(rowid) from wi_cumulative; =20
COUNT(ROWID)

    12148659
=20
Elapsed: 00:00:20.62
SQL> select count(1) from wi_cumulative; =20
  COUNT(1)



  12148659
=20
Elapsed: 00:00:21.52
SQL> select count(null) from wi_cumulative; =20
COUNT(NULL)

          0
=20
Elapsed: 00:00:19.12
SQL> Tanel's favorite way of counting differed from the real count for only = about
12 million rows,
and it wasn't that much faster, so the difference doesn't justify lack = of
precision.
--=20
Mladen Gogala
Oracle DBA

Note:
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. = If
you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify = the
sender. You must not, directly or indirectly, use, disclose, = distribute,
print, or copy any part of this message if you are not the intended recipient. Wang Trading LLC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized = to
state them to be the views of any such entity.



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

_________________________________________________________________________=
__=20


This email and any attached to it are confidential and intended only for =
the
individual or entity to which it is addressed.  If you are not the =
intended
recipient, please let us know by telephoning or emailing the sender.  =
You
should also delete the email and any attachment from your systems and =
should
not copy the email or any attachment or disclose their content to any =
other
person or entity.  The views expressed here are not necessarily those of
Churchill Insurance Group plc or its affiliates or subsidiaries. Thank =
you.=20

Churchill Insurance Group plc.  Company Registration Number - 2280426.
England.=20

Registered Office: Churchill Court, Westmoreland Road, Bromley, Kent BR1
1DP.=20


----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Thu Jul 08 2004 - 09:47:56 CDT

Original text of this message

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