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: select count(*) optimization

Re: select count(*) optimization

From: L120bj <l120bj_at_aol.com>
Date: 1997/03/07
Message-ID: <19970307184000.NAA23737@ladder01.news.aol.com>#1/1

If you change the * to be the first column of the primary key, then the count will be performed on the elements in the index.




Subject: select count(*) optimization
From: jim nash <jimnash_at_sprintmail.com>
Date: Wed, 05 Mar 1997 08:23:41 -0800
Message-ID: <331D9E0D.4B3E_at_sprintmail.com>

Anyone know how to fool the optimizer into using a primary key access path to count all rows in a table? e.g.

    select count(*) from blah;

In my case the rows are very long, the prim key is very short, and the full table scan brings the machine to its knobby knees.

Received on Fri Mar 07 1997 - 00:00:00 CST

Original text of this message

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