From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias Ackermann <matt@webcraft.ch>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] Usage of index in "ORDER BY" operations
Date: Sat, 27 Nov 1999 12:18:02 -0500
Message-ID: <18588.943723082@sss.pgh.pa.us> (raw)
In-Reply-To: <383FF97F.8F408F3B@webcraft.ch>
Matthias Ackermann <matt@webcraft.ch> writes:
> So it seems that inserting a WHERE-clause, even if it doesn't do
> anything at all (i.e. doesn't reduce the result-set),
> is necessary to force the DB to make use of the index.
This is true in 6.5: it never even considers an indexscan plan unless
there is a WHERE clause that could make use of the index. 7.0 will
be smarter. (Current CVS sources already know about making an indexscan
plan with no other purpose than to satisfy an ORDER BY; in fact they are
probably *too* eager to make use of an index, and will pick that method
even when a linear scan and explicit sort would be faster. I need to
rejigger the cost estimates to be more realistic, especially by taking
LIMIT into account.)
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, matt@webcraft.ch, pgsql-sql@hub.org
Subject: Re: [SQL] Usage of index in "ORDER BY" operations
In-Reply-To: <18588.943723082@sss.pgh.pa.us>
References: <383FF97F.8F408F3B@webcraft.ch> <18588.943723082@sss.pgh.pa.us>
* 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