pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Seamus Abshere <seamus@abshere.net>
To: pgsql-general@postgresql.org
Subject: Re: Is my text_pattern_ops index working for a LIKE prefix search with column reference?
Date: Fri, 24 Aug 2018 02:46:38 +0200
Message-ID: <d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at> (raw)
In-Reply-To: <1535036221.3796184.1483854296.64E1B683@webmail.messagingengine.com>
References: <1535036221.3796184.1483854296.64E1B683@webmail.messagingengine.com>

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





view thread (3+ messages)  latest in thread

Message-ID: <d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at>
Permalink:  ../d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at/
Also on:    postgresql.org/message-id/d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, seamus@abshere.net
  Subject: Re: Is my text_pattern_ops index working for a LIKE prefix search with column reference?
  In-Reply-To: <d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at>
  References: <1535036221.3796184.1483854296.64E1B683@webmail.messagingengine.com> <d599d4592b68dbac18beab4daf15358a4bfa9b64.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox