Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Any way to get RowCount by not using Select count(*) from table
There are many ways of achieving the same result. Some ways are more
efficient than others and I think that is what boonsong was asking.
If your table has a primary key (what table doesn't? :) ) You'll get the quickest results by 'select count(customer_id) from customer' because the number of reads on an index is less than a full table scan. You should see about 15% increase in speed.
In article <368a8bd8.10556391_at_news.siol.net>, jmodic_at_src.si (Jurij Modic)
wrote:
>On Tue, 29 Dec 1998 14:29:57 -0800, Jonathan Ingram
><jonathan.ingram_at_miname.com> wrote:
>
>>boonsong wrote:
>>
>>> Any way to get RowCound by not using Select count(*) from table
>>
>>Yes. Don't select count (*); instead, do one of the following:
>>
>> select count (1) from <table>;
>> select count (rowid) from <table>;
>
>Which, in any case, will return exactly the same result as "select
>count(*)"
>
>>Jonathan
>
>Regards,
>Jurij Modic <jmodic_at_src.si>
>Certified Oracle7 DBA (OCP)
>================================================
>The above opinions are mine and do not represent
>any official standpoints of my employer
Received on Sun Jan 03 1999 - 20:37:36 CST