Reverse btree indexes

2021-06-22 Thread Zach Aysan
Hey there! Thanks for putting together such wonderful documentation. I have
a small suggestion for improvement.

*Page:* https://www.postgresql.org/docs/13/indexes-types.html

*Existing language:*

for example, col LIKE 'foo%' or col ~ '^foo', but not col LIKE '%bar'.


*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:*


> 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').


I hope you all have a great day!

Zach


Operator function clarification needed

2021-06-22 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/gin-builtin-opclasses.html
Description:

https://www.postgresql.org/docs/12/gin-builtin-opclasses.html

It is unclear what the operators do. Page should link to relevant section(s)
of documentation defining operators.


Re: Reverse btree indexes

2021-06-22 Thread David G. Johnston
On Tue, Jun 22, 2021 at 2:28 PM Zach Aysan  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.