Search Postgresql Archives

Re: Special index for "like"-based query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/30/2016 12:33 AM, David G. Johnston wrote:
On Thu, Dec 29, 2016 at 4:21 PM, Job <Job@xxxxxxxxxxxxxxxxxxxx
<mailto:Job@xxxxxxxxxxxxxxxxxxxx>>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.htmlhttps://www.postgresql.org/docs/9.6/static/btree-gist.html

For prefix queries, it's also possible to use simple btree index with varchar_pattern_ops.

https://www.postgresql.org/docs/9.6/static/indexes-opclass.html


regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux