Re: More efficient ways to do a select count(*)

From: Toon Koppelaars <toon.koppelaars_at_rulegen.com>
Date: Fri, 20 Mar 2009 12:08:46 +0100
Message-ID: <ecf3dae70903200408s6751c419t576cb754ce1d0680_at_mail.gmail.com>



Web applications often do this to implement "pagination". See also:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:1137577300346084930

Toon Koppelaars
RuleGen BV
+31-615907269
Toon.Koppelaars_at_RuleGen.com
http://www.RuleGen.com
http://thehelsinkideclaration.blogspot.com

(co)Author: "Applied Mathematics for Database Professionals" http://www.RuleGen.com/pls/apex/f?p=14265:13

On Fri, Mar 20, 2009 at 11:58 AM, FmHabash <fmhabash_at_gmail.com> wrote:

> I see often times applications run such query on a high frequency basis and
> this seemingly harmless query becomes a top cpu consumer.
> For whatever reason applications need to do this, how else such query can
> written to avoid the FTS it often does.
> In a quick test, I saw doing count(primary key) is much faster and xplan
> shows index vs. FTS access path.
> For this particular issue, there is no PK on the table and using a UK does
> guarantee a not-null value.
> Any other ideas (parallel exec is not an option).
>
> Thanks
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 20 2009 - 06:08:46 CDT

Original text of this message