> Date: Thu, 15 Oct 1998 10:56:50 +0200
Andreas Zeugswetter wrote:
> 
> Resumee:
> You have to look at this from the cost point of view. If there is an order by that can be 
> done with an index, this will make the index a little more preferrable than for the same 
> query without the order by, but it should not force the index.
> You have to give the sort a cost, so that the index access can be compared to the
> seq scan and sort path.

But if we finally get only 10 first rows, it may still be _much_ faster 
to do just the index scan, which, being the toplevel executor will get 
only the needed rows.

So here we come back to the LIMIT clause (or something like it) because 
the optimiser has no knowledge whatever about the use of DECLARE/FETCH 
(I assume).



------------------
Hannu Krosing

Thu, 15 Oct 1998 17:08:12 +0300
Hannu Krosing <hannu@trust.ee>
Re: order by and index path (was: What about LIMIT in SELECT ?)