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: Tanel Põder <tanel.poder.003_at_mail.ee>
Date: Thu, 8 Jul 2004 11:38:01 +0300
Message-ID: <016901c464c6$e1250b20$bff923d5@porgand>


I've actually seen an "expert" optimizing the count() statement, by using count(null) "since null means nothing and thus is the fastest" :)

But check this:

SQL> select count(*) from dual;

  COUNT(*)


         1

SQL> select count(null) from dual;

COUNT(NULL)


          0

Tanel.

> > On Thu, 8 Jul 2004 11:27:28 +0530 oracle-l_at_freelists.org wrote:
> > > Can you let me know the difference between count(*) and count(1) ?
> >
> > count(1) is supposed to be more efficient and faster.
>
> Oh boy, here we go.
>
> --
> Jeremiah Wilton
> http://www.speakeasy.net/~jwilton
> ----------------------------------------------------------------
> 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 - 03:36:14 CDT

Original text of this message

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