Re: [GENERAL] text_pattern_ops index not being used for prefix query

2016-10-21 Thread Alexander Staubo
On 20 Oct 2016, at 23:37, Maxim Boguk wrote: > ​Underscore in like pattern have a special meaning of "any symbol". > From documentation on the > https://www.postgresql.org/docs/9.4/static/functions-matching.html : > "An underscore (_) in pattern stands for (matches) any single character;" > This

Re: [GENERAL] text_pattern_ops index not being used for prefix query

2016-10-20 Thread Maxim Boguk
On Fri, Oct 21, 2016 at 8:42 AM, Alexander Staubo wrote: > Indexing on a text column: > > create index index_documents_on_id_with_pattern_ops (id > text_pattern_ops); > > This works fine: > > > explain select id from documents where id like 'dingbat%'; > Index Only Scan using index_do

[GENERAL] text_pattern_ops index not being used for prefix query

2016-10-20 Thread Alexander Staubo
Indexing on a text column: create index index_documents_on_id_with_pattern_ops (id text_pattern_ops); This works fine: > explain select id from documents where id like 'dingbat%'; Index Only Scan using index_documents_on_id_with_pattern_ops on documents (cost=0.56..8.58 rows=736 wi