Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Need a Fast Row Count
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...Received on Thu Apr 27 2000 - 00:00:00 CDT
> 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
>