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: Need a Fast Row Count

Re: Need a Fast Row Count

From: Bob Fazio <rfazio_at_home.com.nospam>
Date: 2000/04/27
Message-ID: <Ni2O4.155657$Tn4.1014458@news1.rdc2.pa.home.com>#1/1

When you do a count without a where clause Oracle in almost all cases will do a full table scan. It will read all rows and all columns (except long's) no matter what you specify. In some cases adding a hint to use

select /*+ index_ffs(a pk_a) */ count(pk_column) from a;

can sometimes make the count faster.

--
rfazio_at_home.com
http://24.8.218.197/

<kskasi_at_hotmail.com> wrote in message news:38E291C3.CF3DC237_at_hotmail.com...

> Hi Simone
>
> For your info Count(*) is faster than count(1). Unbeleivable Isn't it. But
> thats the fact.
> ...kasi
>
> Simone Jesse wrote:
>
> > How much faster is your count if you use
> > select count(1) from... ?
> > In this case only the first column of every row will be read, not the
whole
> > row!
> >
> > This might not be as quick as some of the other ideas, but I would be
> > interested in the statistics.
> > Unfortunately none of my tables is big enough to really make a
difference!
> >
> > Simone
>
Received on Thu Apr 27 2000 - 00:00:00 CDT

Original text of this message

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