From: Artur Zakirov <a.zakirov@postgrespro.ru>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: ruslan.zakirov@gmail.com, Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14032: trigram index is not used for '=' operator
Date: Mon, 21 Mar 2016 11:28:52 +0300
Message-ID: <56EFB0C4.2000308@postgrespro.ru> (raw)
In-Reply-To: <CAMkU=1wCVDDgwxKstHEQ_d5075FnDWXJpM0LxqhQsDD-vvg3mw@mail.gmail.com>
References: <20160318100427.2903.57536@wrigleys.postgresql.org>
<CAKNkYnw4C8MLYqF-L38i2EPoJkWy1UvTo=cm6kHE7zphukex=g@mail.gmail.com>
<CAMkU=1wCVDDgwxKstHEQ_d5075FnDWXJpM0LxqhQsDD-vvg3mw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 20.03.2016 04:06, Jeff Janes wrote:
>
> I think it is actually quite trivial to support '='. In fact I think
> that all you have to do is tap into the same code that LIKE already
> uses, and let the recheck remove things which match on the LIKE
> interpretation of the query string but not the equality
> interpretation.
>
> Attached is a crude patch I put together which seems to do the job,
> but I haven't thoroughly tested it.
>
> The main problem is likely to be that there is already a really good
> index type for speeding up equality queries (btree), and adding
> another (generally much worse) alternative is likely to confuse the
> planner more than anything. Is it really worth taking the performance
> hit on executing the equality query in order to avoid just keeping a
> second btree index?
Maybe not :)
>
> If I could somehow turn this into an extension module that installed
> with pg_trgm as a dependency, rather than reaching into pg_trgm's
> internals, then it might be worthwhile putting something like this on
> PGXN. But I don't know how to do that. And it doesn't seem
> worthwhile to change pg_trgm itself in this way.
>
> But in any case, it isn't a bug that pg_trgm doesn't do everything it
> theoretically could do.
Yes. And so this changes can be applied only for PostgreSQL 9.7.
>
> Cheers,
>
> Jeff
>
--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: a.zakirov@postgrespro.ru, jeff.janes@gmail.com
Subject: Re: BUG #14032: trigram index is not used for '=' operator
In-Reply-To: <56EFB0C4.2000308@postgrespro.ru>
References: <20160318100427.2903.57536@wrigleys.postgresql.org> <CAKNkYnw4C8MLYqF-L38i2EPoJkWy1UvTo=cm6kHE7zphukex=g@mail.gmail.com> <CAMkU=1wCVDDgwxKstHEQ_d5075FnDWXJpM0LxqhQsDD-vvg3mw@mail.gmail.com> <56EFB0C4.2000308@postgrespro.ru>
* 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