Re: Special index for "like"-based query

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Job <Job(at)colliniconsulting(dot)it>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Special index for "like"-based query
Date: 2016-12-29 23:33:59
Message-ID: CAKFQuwaAPR0_ki2OPGwXtK1MzpLECZHeDnd1Rkvb3zh7_Vdtag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 29, 2016 at 4:21 PM, Job <Job(at)colliniconsulting(dot)it> wrote:

> Hello,
>
> in Postgresql 9.6 we have a query running on a very large table based, in
> some cases, on a like statement:
>
> ... WHERE FIELD='CODE' OR FIELD LIKE 'CODE_%'
>
> Which type of index can i create to speed to the search when the "like"
> case happens?
>

​GIST​

https://www.postgresql.org/docs/9.6/static/pgtrgm.html

​https://www.postgresql.org/docs/9.6/static/btree-gist.html

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2016-12-29 23:38:57 Re: Special index for "like"-based query
Previous Message Tim Uckun 2016-12-29 23:32:17 Re: Performance PLV8 vs PLPGSQL