Re: Backwards index scan

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Backwards index scan
Date: 2003-07-07 21:44:46
Message-ID: 20030707144149.H81868-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general pgsql-hackers


On Mon, 7 Jul 2003, Dmitry Tkach wrote:

> I understand that with the generic approach to operators in postgres it
> is, probably, not very feasible to try and teach _bt_first () to handle
> this situation automatically (it would need to know how to get
> next/previous value for every indexable type)... I guess, that could be
> done by adding another kind of strategy to pg_amop for example...
> Another way to work around this would be to allow ordering spec to be a
> part of CREATE INDEX (I know, that informix does that for example) - so
> that, I could do
> create index huge_table_idx on huge_table (x, y desc);
> ... and then select * from huge_table where x=10 order x, y desc;
> would not require a backwards scan to begin with.
>
> Can something like this be done? What do you think?

If you make an opclass that orders in the reverse order you can use that
opclass in creating the index (which effectively can give you an index
like x, y desc by using the new opclass on y). There was some talk
recently about whether we should provide such opclasses as builtins or
contrib items.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mike Quinn 2003-07-07 21:58:01 pg_tables view definition incorrect??
Previous Message Dmitry Tkach 2003-07-07 18:18:55 Backwards index scan

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2003-07-07 21:58:00 Re: making multiple updates use indexes: howto?
Previous Message Clay Luther 2003-07-07 21:00:20 Re: www.postgresql.org FUBAR

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-07 21:58:53 Re: Backwards index scan
Previous Message Oleg Bartunov 2003-07-07 20:35:05 Re: How to submit Tsearch V2 ?