Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: select count(*) optimization
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.
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.