Re: Reverse Key Index

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Reverse Key Index
Date: 2015-02-26 12:48:03
Message-ID: mcn4m4$o9b$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Sven R. Kunze schrieb am 26.02.2015 um 13:23:
> If you think Reverse Key Indexes have no usage here in PostgreSQL, you should not support convenience features
> for easily improving performance without breaking the querying API

It's also unclear to me which "performance" you are referring to.
Insert performance? Retrieval performance? Concurrency?

The use-case for reverse indexes in Oracle is pretty small: it's _only_ about the contention when doing a lot of inserts with increasing numbers (because the different transactions will be blocked when accessing the blocks in question).

As Postgres manages inserts differently than Oracle I'm not so sure that this problem exists in Postgres the same way it does in Oracle.
That's why I asked if you have a _specific_ problem.

Richard Footes blog post is mostly about the myth that _if_ you have a reverse index this is only used for equality operations.
It does not claim that a reverse index is faster than a regular index _if_ it is used for a range scan.

The question is: do you think you need a reverse index because you have a performance problem with when doing many, many inserts at the same time using "close-by" values into a table that uses a btree index on the column?

Or do you think you need a reverse index to improve the performance of a range scan? If that is the then you can easily us a gin/gist index or even a simple btree index using a trigram index to speed up a "LIKE '%abc%'" (something Oracle can't do at all) without having to worry about obfuscation layers (aka ORM).

Thomas

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Sven R. Kunze 2015-02-26 13:20:48 Re: Reverse Key Index
Previous Message Heikki Linnakangas 2015-02-26 12:37:04 Re: Reverse Key Index