pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hannu Krosing <hannu@trust.ee>
To: Andreas Zeugswetter <andreas.zeugswetter@telecom.at>
Cc: pgsql-hackers@postgresql.org
Subject: Re: order by and index path (was: What about LIMIT in SELECT ?)
Date: Thu, 15 Oct 1998 17:08:12 +0300
Message-ID: <362601CC.AA5032C2@trust.ee> (raw)

> 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



Message-ID: <362601CC.AA5032C2@trust.ee>
Permalink:  ../362601CC.AA5032C2@trust.ee/
Also on:    postgresql.org/message-id/362601CC.AA5032C2@trust.ee

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: hannu@trust.ee, andreas.zeugswetter@telecom.at
  Subject: Re: order by and index path (was: What about LIMIT in SELECT ?)
  In-Reply-To: <362601CC.AA5032C2@trust.ee>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox