Re: Reverse Key Index

From: "Sven R(dot) Kunze" <srkunze(at)tbz-pariv(dot)de>
To: hlinnaka(at)iki(dot)fi, Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Reverse Key Index
Date: 2015-03-05 09:17:51
Message-ID: 54F81F3F.3010607@tbz-pariv.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 26.02.2015 13:37, Heikki Linnakangas wrote:
> On 02/26/2015 12:31 AM, Josh Berkus wrote:
>> On 02/14/2015 10:35 AM, Sven R. Kunze wrote:
>>> Thanks for the immediate reply.
>>>
>>> I understand the use case is quite limited.
>>>
>>> On the other hand, I see potential when it comes to applications which
>>> use PostgreSQL. There, programmers would have to change a lot of
>>> code to
>>> tweak existing (and more importantly working) queries to
>>> hash/reverse an
>>> id column first. Using ORMs would make this change even more painful
>>> and
>>> maybe even impossible.
>>>
>>> When reading
>>> https://richardfoote.wordpress.com/2008/01/14/introduction-to-reverse-key-indexes-part-i/
>>>
>>> carefully, it also seems to work with index scan partially in case of
>>> equality comparisons.
>>
>> Seems like a good use for SP-GiST. Go for it!
>
> A b-tree opclass that just compares from right-to-left would work just
> as well, and perform better.
>
> - Heikki
>

Thanks for the hint. That also sounds easy to implement.

Regards,

--
Sven R. Kunze
TBZ-PARIV GmbH, Bernsdorfer Str. 210-212, 09126 Chemnitz
Tel: +49 (0)371 33714721, Fax: +49 (0)371 5347920
e-mail: srkunze(at)tbz-pariv(dot)de
web: www.tbz-pariv.de

Geschäftsführer: Dr. Reiner Wohlgemuth
Sitz der Gesellschaft: Chemnitz
Registergericht: Chemnitz HRB 8543

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gunnlaugur Thor Briem 2015-03-05 15:01:58 Re: EXPLAIN (no ANALYZE) taking an hour for INSERT FROM SELECT
Previous Message Jim Nasby 2015-03-05 08:25:42 Re: Re: [pgadmin-support] Issue with a hanging apply process on the replica db after vacuum works on primary