Re: BUG #14032: trigram index is not used for '=' operator

From: Emre Hasegeli <emre(at)hasegeli(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>, ruslan(dot)zakirov(at)gmail(dot)com, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14032: trigram index is not used for '=' operator
Date: 2016-03-24 15:11:55
Message-ID: CAE2gYzzcnKzp1XYDVvG21U7DeV71oGRF8J-w=oc4atgZfvjxKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> 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?

I don't think it is a problem. I think btree would usually have lower
cost than GIN and therefore would be preferred by the planner. The
other opclasses are providing operators for such cases. For example,
range_ops(GiST) supports =, inet_ops(GiST) supports all basic
comparisons.

It is likely that pg_trgm index created for pattern matching would be
sufficient for equality for some users. We shouldn't force them to
create an additional btree index.

> 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.

I don't think it is useful to have such a small extension, even if it
would be possible.

> But in any case, it isn't a bug that pg_trgm doesn't do everything it
> theoretically could do.

I agree. Maybe we can add it to the next commitfest?

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2016-03-24 15:30:36 Re: [BUGS] BUG #13854: SSPI authentication failure: wrong realm name used
Previous Message Robbie Harwood 2016-03-24 15:07:16 Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used