Re: BUG #14032: trigram index is not used for '=' operator - Mailing list pgsql-bugs

From Emre Hasegeli
Subject Re: BUG #14032: trigram index is not used for '=' operator
Date
Msg-id CAE2gYzzcnKzp1XYDVvG21U7DeV71oGRF8J-w=oc4atgZfvjxKQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #14032: trigram index is not used for '=' operator  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: BUG #14032: trigram index is not used for '=' operator
Re: BUG #14032: trigram index is not used for '=' operator
List 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?

pgsql-bugs by date:

Previous
From: Robbie Harwood
Date:
Subject: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] BUG #13854: SSPI authentication failure: wrong realm name used