Re: Behavior of a pg_trgm index for 2 (or < 3) character LIKE queries - Mailing list pgsql-hackers

From Sawada Masahiko
Subject Re: Behavior of a pg_trgm index for 2 (or < 3) character LIKE queries
Date
Msg-id CAD21AoBewYm2Xm6S6wrsdzSiY93ygJw4V+yunVgHrxODmqpQYg@mail.gmail.com
Whole thread Raw
In response to Re: Behavior of a pg_trgm index for 2 (or < 3) character LIKE queries  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: Behavior of a pg_trgm index for 2 (or < 3) character LIKE queries  (Alexander Korotkov <aekorotkov@gmail.com>)
List pgsql-hackers
2013/5/31 Amit Langote <amitlangote09@gmail.com>
>
> On Thu, May 30, 2013 at 11:47 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> > On Wed, May 29, 2013 at 10:51 PM, Amit Langote <amitlangote09@gmail.com> wrote:
> >> So, it appears, for search strings consisting of 2 (or < 3)
> >> characters, trigrams can not be utilized. No?
> >
> > I think that's right.  "trigram" means a sequence of three characters,
> > and what's stored in the indexes are three-character sequences from
> > the original text.
> >
>
> Was there any improvement to pg_trgm in recent past that could make it
> better for partial matching (the case in question I suppose) or is
> partial-matching a different thing altogether?
>

Hi Amit,

following emails are discussed about partial match of pg_trgm.  I hope
will this help.
<http://www.postgresql.org/message-id/CAHGQGwFJshvV2nGME19wdTW9teFw_w7h2ns4E+YYsjkB9WdWDQ@mail.gmail.com>
as you may know, if search string contains multibyte characters
trigram key is converted to CRC of 4 byte and it is used as key.
(but only use upper 3 byte from CRC)
so we can do partial matching if KEEPONLYALNUM is enabled.

Regards,

--------
Masahiko Sawada



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Behavior of a pg_trgm index for 2 (or < 3) character LIKE queries
Next
From: Dean Rasheed
Date:
Subject: 9.3: Empty arrays returned by array_remove()