From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Antal Attila <antal.attila@ritek.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Multi ordered select and indexing
Date: Fri, 23 Apr 2004 09:41:21 -0700 (PDT)
Message-ID: <20040423093937.B17459@megazone.bigpanda.com> (raw)
In-Reply-To: <000301c4293f$ebf6b930$0b02010a@atesz>
References: <000301c4293f$ebf6b930$0b02010a@atesz>
On Fri, 23 Apr 2004, Antal Attila wrote:
> Hi!
>
> We have a complex problematic area. What is the simplest solution for
> the next query type:
>
> SELECT * FROM tablename ORDER BY col1 ASC, col2 DESC;
>
> In our experience, postgres cannot use a multi-colum index on (col1,
> col2) in this situation, becouse there are different directions after
> ORDER BY. Is custom operator class the easiest solution, which can solve
> the reverse indexing on col2? Our problem with this solution, is that we
> have to replace "DESC" with "USING myoperator". Is it possible, that
> postgres can recognize "myoperator" without replacing "DESC"?
Yes. You should be able to make an opclass where the operators are the
standard operators but in a different order which should get used when
doing DESC. I think there should be examples in the archives.
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-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, antal.attila@ritek.hu
Subject: Re: Multi ordered select and indexing
In-Reply-To: <20040423093937.B17459@megazone.bigpanda.com>
* 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