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: Count(*) is very slow

Re: Count(*) is very slow

From: Jack Carter <jccarter_at_flash.net>
Date: Tue, 20 Oct 1998 09:22:41 -0500
Message-ID: <70i6g5$24k$1@excalibur.flash.net>


Just do a ... Select count (primary key column) from ? instead of Select count(*) and it will use the index.

Andreas Kyritz wrote in message <70i5pa$siv$1_at_news.ipf.net>...
>Hi Billy,
>
>Billy Verreynne schrieb in Nachricht <70h7sq$1mv$1_at_hermes.is.co.za>...
>...
>>I've read several responses to this and everyone seems to suggest that an
>>analyze will make it faster. I'm not so sure. Does Oracle not always use a
>>FTS when doing a SELECT count(*)? I use to run SELECT count(*) on large
>>tables to test PQ - and PQ only kicks in with FTS (at least with 7.x).
>
>Now my database is very well analyzed, but it makes no difference.
>Why isn't it possible to use the primary key for computing SELECT count(*)
>FROM ...?
>I think, most dbms doing it in this way.
>
>>
>>The only reason IMHO why a SELECT count(*) may be faster when an analyze
>has
>>been done, is for PQ processing. If an estimate stats has been made,
Oracle
>>spreads the processing better between the PQ processes (it uses rowid per
>>select to give each PQ a chunk of the table to process). If there are no
>>stats, Oracle often give all the work to 1 or 2 PQs only while the rest
sit
>>idle.
>
>
>Unfortunenably I have only one processor in my server 8-( . Or works PQ
also
>with one processor in 2 and more threads, there are mostly 75% free
>cpu-ressources on the system ?
>
>>Or am I trying to drink from an empty Tennessee whiskey bottle here?
>8-)
>
>
>--
>Andreas Kyritz
>AKyritz_at_easy-soft-dresden.de
>
>
Received on Tue Oct 20 1998 - 09:22:41 CDT

Original text of this message

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