Re: Is my text_pattern_ops index working for a LIKE prefix search with column reference?

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Seamus Abshere <seamus(at)abshere(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Is my text_pattern_ops index working for a LIKE prefix search with column reference?
Date: 2018-08-24 00:46:38
Message-ID: d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Seamus Abshere wrote:
> I created an index with text_pattern_ops because I want fast prefix search [1] [2].
>
> ...but I don't think it's working when I use a column reference || '%'...

An index can only be used for expressions like

<indexed expression> <operator from the opclass> <constant>

and you have a column refrence on the right side.

Perhaps you can rephrase your query in such a fashion.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raghavendra Rao J S V 2018-08-24 02:03:04
Previous Message Tom Lane 2018-08-23 21:51:03 Re: Join condition parsing puzzle