Re: Reverse btree indexes

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Zach Aysan <zachaysan(at)gmail(dot)com>
Cc: Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Reverse btree indexes
Date: 2021-06-22 22:51:23
Message-ID: CAKFQuwYsDe8gVLL66oSDKbDZ6Ln72ygDp=R2CPfd7Ri7acRPkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, Jun 22, 2021 at 2:28 PM Zach Aysan <zachaysan(at)gmail(dot)com> wrote:

> *Desired improvement:*
>
> for example, col LIKE 'foo%' or col ~ '^foo', but not col LIKE '%bar',
>> which would require a reversed index on the field. Postgres will
>> automatically use the reverse index for LIKE '%bar'
>
>
> *Or if it doesn't:*
>

It doesn't, otherwise the documentation wouldn't need to point out: but not
col LIKE '%bar' ...

>
>> for example, col LIKE 'foo%' or col ~ '^foo', but not col LIKE '%bar',
>> which would require a reversed index on the field. To use the reversed
>> index, query with reverse(col) like reverse('%bar').
>
>
>
This type of commentary isn't usually something we include in the
documentation...and I'm not too keen on "reversed index" as a phrase
regardless.

David J.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2021-06-23 05:16:29 Change CLIENT_ENCODING to client_encoding plus a question on "SET NAMES"
Previous Message Zach Aysan 2021-06-22 18:46:52 Reverse btree indexes