| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: select count(*) optimization
In article <331D9E0D.4B3E_at_sprintmail.com>,
jim nash <jimnash_at_sprintmail.com> wrote:
>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.
The following might help:
select count(primary key) from blah;
(I suppose NULL values are not allowed in your PK, and you have an index on PK)
Stefan.
Name :G.R.S. Deisz
Phone :+31-50-5855954
E mail :G.R.S.Deisz_at_PTT-Telecom.Unisource.NL
DISCLAIMER:This statement is not an official statement from, nor
does it represent an official position of, PTT Telecom BV.
Received on Mon Mar 10 1997 - 00:00:00 CST
![]() |
![]() |