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: counting rows

Re: counting rows

From: °­¸í±Ô <myunggyu_at_orgio.net>
Date: Wed, 29 Nov 2000 23:14:17 +0900
Message-ID: <9032d0$lsa$1@news2-2.kornet.net>

How about using

select count(1) from table;
or
select count(rowid) from table;

I don't know exactly.. but,
I heard that this is better than count(*)

sorry to bad english..

"Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote in message news:9026og$5vh0k$4_at_ID-62141.news.dfncis.de...
>
> "Aaron D. Hager" <adhager_at_onebox.com> wrote in message
> news:90250b$1jj$1_at_newsmaster.cc.columbia.edu...
> > Does anyone know a faster way of counting the number of rows in a table
> > (using OCI or SQL) other than
> > SELECT COUNT (*) FROM table
> > ?
> >
> > Thanks,
> >
> > Aaron
> >
> >
> As you provide no clues as to which platform you might be running, it is
> impossible to come up with a specific answer. Generally speaking select
> count(*) is the only method to get *correct,adequate* results. Someone may
> advise to use num_rows from the datadictionary, but that would only be
 valid
> directly following an analyze compute statistics, as analyze estimate
> estimates num_rows too.
> If your tables are indexed you could consider adding a dummy where clause
 on
> the index, as that will force the Cost Based Optimizer to use an index
 fast
> full scan on the table (so without reading the table).
>
> Hth,
>
> Sybrand Bakker, Oracle DBA
>
>
>
Received on Wed Nov 29 2000 - 08:14:17 CST

Original text of this message

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