The following bug has been logged on the website:
Bug reference: 16835 Logged by: Hongyan (Heather) Zhang Email address: [hidden email] PostgreSQL version: 11.9 Operating system: aurora postgres 11 Description: https://www.postgresql.org/docs/11/indexes-types.html, according to this page, btree index is supposed to work for where clause col like 'foo%', but does not work for me. we are on aurora postgres 11, I also tested on postgres 11, it does not work either. |
PG Bug reporting form <[hidden email]> writes:
> https://www.postgresql.org/docs/11/indexes-types.html, according to this > page, btree index is supposed to work for where clause col like 'foo%', but > does not work for me. we are on aurora postgres 11, I also tested on > postgres 11, it does not work either. As the manual explains, that will not work by default unless your database locale is C (which is an uncommon default nowadays). It's also possible that Aurora has changed something that keeps it from working, but I'd investigate the locale angle first. regards, tom lane |
Thanks, Tom. Locale is en_US.UTF-8. Is there plan to alter that behavior to allow index in non C locale?
From: Tom Lane <[hidden email]> **** External Email - Use Caution **** NOTICE TO RECIPIENT OF INFORMATION: |
De: "Zhang, Hongyan" <[hidden email]> Para: "Tom Lane" <[hidden email]> Cc: "pgsql-bugs" <[hidden email]> Enviadas: Sexta-feira, 22 de janeiro de 2021 16:07:22 Assunto: Re: [EXTERNAL] Re: BUG #16835: btree index does not work for where clause using 'foo%' Thanks, Tom. Locale is en_US.UTF-8.
Is there plan to alter that behavior to allow index in non C locale?
According to documentation: "However, if your database does not use the C locale you will need to create the index with a special operator class to support indexing of pattern-matching queries;" So you'll have to create the index with a specific operator class. You can use:. CREATE INDEX tbl_col_text_pattern_ops_idx ON tbl(col text_pattern_ops) [1] [1] https://stackoverflow.com/questions/1566717/postgresql-like-query-performance-variations |
Thanks, Luis From: "[hidden email]" <[hidden email]> **** External Email - Use Caution **** De:
"Zhang, Hongyan" <[hidden email]> Thanks, Tom. Locale is en_US.UTF-8. Is there plan to alter that behavior to allow index in non C locale?
According to documentation: "However, if your database does not use the C locale you will need to create
the index with a special operator class to support indexing of pattern-matching queries;" So you'll have to create the index with a specific operator class. You can use:. CREATE INDEX tbl_col_text_pattern_ops_idx ON tbl(col text_pattern_ops) [1] NOTICE TO RECIPIENT OF INFORMATION: |
Free forum by Nabble | Edit this page |