Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: count(*)

Re: count(*)

From: Norman Dunbar <Norman.Dunbar_at_lfs.co.uk>
Date: Tue, 9 Apr 2002 09:44:41 +0100
Message-ID: <E2F6A70FE45242488C865C3BC1245DA701D23D08@lnewton.leeds.lfs.co.uk>


-----Original Message-----
From: anil.chada_at_oracle.com (anil chada) [mailto:anil.chada_at_oracle.com] Posted At: Monday, April 08, 2002 5:06 PM

>> Just a thought ...
>> If you have a primary key column in the table..
>> then doing

>> select count(primary_key_column)
>> from table;

>> would be faster, because then oracle will count the records in the
>> index, rather than going through all the blocks related to the
table..

>> correct me, if i am wrong..

It depends on the optimiser and version of Oracle - as explained here : http://www.jlcomp.demon.co.uk/faq/count_rows.html

Regards,
Norman.



Norman Dunbar			EMail:	Norman.Dunbar_at_LFS.co.uk
Database/Unix administrator	Phone:	0113 289 6265
				Fax:	0113 289 3146
Lynx Financial Systems Ltd.	URL:	http://www.Lynx-FS.com
------------------------------------------------------------------------

Received on Tue Apr 09 2002 - 03:44:41 CDT

Original text of this message

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