Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Count(*) is very slow
Hi Billy,
Billy Verreynne schrieb in Nachricht <70karf$3md$1_at_hermes.is.co.za>...
>
>A SELECT count(*) tells the database engine to count the number of rows in
a
>table. Not the number of index entries. :-)
>
It doesn't matter, how the database engine counts the rows, but they SHOULD
DO IT FAST.
On my oracle system the 'select count(*) from ...' command is a dangerous
one, if there more than 50.000 rows in the table.
8-)
I've analyzed the command with EXPLAIN PLAN. It seems that it's not possible
to prevent the fulltablescan.
(Select Count(PRIMARY_KEY) from ATABLE, Select Count(PRIMARY_KEY) from
ATABLE where ALWAYS_TRUE_CONDITION, ...)
The summary is: Don't use 'Select Count(*) from ATable', if it's possible.
Thanks for your help
--
Andreas Kyritz
AKyritz_at_easy-soft-dresden.de
Received on Wed Oct 21 1998 - 09:32:10 CDT