Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: count(*)
-----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 ------------------------------------------------------------------------
![]() |
![]() |