Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to speed up a "select count(*) from ..."
Hi,
Does the statement have a "where" clause ? The index will only help if you're subsetting the table. If what you're doing is a count of all rows in the table it will do a full table scan (in fact you generally want it to) regardless of available indexing.
Ken F.
"Paolo Polce" <java.group_at_bricabrac.it> wrote in message
news:8eu49s$4676$1_at_stargate1.inet.it...
> Hello,
>
> I have a table with 40.000 records. There was no primary key on the
table
> (!) and a "select count(*) from mytable" took about 15 sec.
> So, now, I've created a primary index on mytable.id field...
>
> Well... it still takes 15 sec to count the records... :-(
> May someone help me?
>
> Thank you.
> Paolo.
>
>
>
Received on Fri May 05 2000 - 00:00:00 CDT