Re: [pg_trgm] Making similarity(?, ?) < ? use an index

From: Greg Navis <contact(at)gregnavis(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [pg_trgm] Making similarity(?, ?) < ? use an index
Date: 2016-06-04 09:50:44
Message-ID: CAA6WWt-KsLcxnm+PS6WmB4muJeWHL245GsusXgow0j1hJMQRRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for your replies.

Sorry for confusion. Instead of `similarity(lhs, rhs) >= show_limit()`,
which of course is completely equivalent to `lhs % rhs`, I wanted to write
`similarity(lhs, rhs) >= my_custom_threshold`. It seems that the approach
with ternary operators is quite a bit of work. I might have a simpler idea:

pg_trgm also provides `<->` but it seems this operator doesn't use indexes
either. It seems the shortest path to per-query thresholds, without
compromising the design, is making this operator use the index. Please help
me understand whether my reasoning is correct. If it is, I'd appreciate a
high-level overview of what needs to be done. I can block a few hours to
work on this in the upcoming weeks.

Best regards
--
Greg Navis
I help tech companies to scale Heroku-hosted Rails apps.
Free, biweekly scalability newsletter for SaaS CEOs
<http://www.gregnavis.com/newsletter/>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Beverley 2016-06-04 11:07:54 Actual rows significantly more than estimated during many joins
Previous Message rverghese 2016-06-03 21:54:36 Re: Partitioned postgres tables don't need update trigger??