From: Your Name <cbbrowne@cbbrowne.com>
To: Mathieu De Zutter <mathieu@dezutter.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-performance@postgresql.org
Subject: Re: Sorting a query on a view ignores an index
Date: Thu, 21 Aug 2003 16:11:37 -0400
Message-ID: <E19pvmT-0003kE-Dw@viper.rx2.net> (raw)
> Apart from avoiding views or subselects when sorting afterwards and
> putting the whole bunch in a huge SQL statement (which i'll have to
> produce on-the-fly), do you have an other alternative?
> The 2 seconds is way to much, as the database will eventually run on a
> machine that is 10 times slower.
Something that isn't _totally_ clear is whether or not it is going to
be possible to make use of indices in the selection. If the postmaster
must assemble, out of disparate sources, a large collection of data,
the best trade-off may very well be to build the collection the best
way the system knows how (perhaps NOT ordering this using the index you
expect), and sort it afterwards.
Sorting doesn't tend to be grieviously expensive except when finding
the query results is also grieviously expensive.
I think you are assuming that the query would be quicker if it used the
sorted index; that is an assumption that should be checked at the door,
or at least checked somewhere.
--
"The main difference between an amateur crypto designer and a used car
salesman is that the used car salesman can probably drive and knows
when he's lying." -- An Metet <anmetet@freedom.gmsociety.org>
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-performance@postgresql.org
Cc: cbbrowne@cbbrowne.com, mathieu@dezutter.org, tgl@sss.pgh.pa.us
Subject: Re: Sorting a query on a view ignores an index
In-Reply-To: <E19pvmT-0003kE-Dw@viper.rx2.net>
References: <E19pvmT-0003kE-Dw@viper.rx2.net>
* 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