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: [Q] what difference between count(0), count(1) and count(*)

Re: [Q] what difference between count(0), count(1) and count(*)

From: O'Neill, Sean <Sean.ONeill_at_organon.ie>
Date: Fri, 26 Oct 2001 06:06:19 -0700
Message-ID: <F001.003B598C.20011026055531@fatcity.com>

>--- aaa aaa <mccdba_at_hotmail.com> wrote:

>> Can anyone tell me what is difference between :
>>
>> select count(*) ... from ..
>>
>> select count(0) ...
>>
>> select coun (1) ...
>> select count(2) ...

For other insights take a look at
http://www.oracledba.co.uk/tips/count_speed.htm

There is also some fun to be had with using select count(*) from within a PL/SQL programming unit then when selecting from SQL*Plus. See MetaLink Doc ID: 1013985.102

I have an e-mail from an Oracle exponent which contains stats showing that the various count() theories are in fact just legend and that your session performs the same amount of work no matter which method you choose.

Where this leaves us all is...........

BTW: If you're into Oracle trivia see can you find out how and where the DUAL table got it's name.

PS: What's your name. Anonymity is not a pre-requisite around here AFAIK.



Sean O' Neill
Organon (Ireland) Ltd.
[subscribed: digest mode]
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: O'Neill, Sean
  INET: Sean.ONeill_at_organon.ie

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Oct 26 2001 - 08:06:19 CDT

Original text of this message

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