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: Lyndon Tiu <ltiu_at_alumni.sfu.ca>
Date: Thu, 8 Jul 2004 07:19:07 -0700
Message-Id: <200407080719.07172.ltiu@alumni.sfu.ca>


On July 8, 2004 12:20 am, Jared Still wrote:
> On Wed, 2004-07-07 at 23:28, Lyndon Tiu wrote:
> > On Thu, 8 Jul 2004 11:27:28 +0530 oracle-l_at_freelists.org wrote:
> > > Dear All,
> > > Can you let me know the difference between count(*) and count(1) ?
> >
> > count(1) is supposed to be more efficient and faster.
>
> Notice the qualifier: 'supposed to be'
>
> Was the claim backed up by evidence?
>

No and it seems that this is an oracle only feature. I tried it (count(1)) on sql server and it does not work. But it works on postgresql though.

I remember reading this from somewhere, whether it is from an official oracle doc or just some db dude on the internet I do not remember. But it seems that other oracle db dudes I've met say the same thing, that count(1) is more efficient. Maybe it's a lie that's been propagated acrosshundreds of generations?

I recall seeing count(1) being faster but then I did not really measure with anything more than counting sheep in my head.

We should experiment and get an empirical result. I will see if I find some time to research this on oracle official docs myself.

--
Lyndon Tiu
----------------------------------------------------------------
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:17:01 CDT

Original text of this message

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