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: Any way to get RowCount by not using Select count(*) from table

Re: Any way to get RowCount by not using Select count(*) from table

From: Richard Vernick <rvernick_at_home.com>
Date: Mon, 04 Jan 1999 02:37:36 GMT
Message-ID: <QPVj2.738$hG2.762@news.rdc1.pa.home.com>


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

Original text of this message

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