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

From: Greg Navis <contact(at)gregnavis(dot)com>
To: Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, "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-20 14:04:31
Message-ID: CAA6WWt-mEHVnDxn=gLh+dmTVSfRgtULjMand-kHq8uq7eTi2Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Artur, thanks for help. I managed to add the new strategy to the index.
Hurray! I also discovered a bug in the process that I reported via the form.

I still have a few questions:

1. Naming - pg_trgm_match, match, threshold, trgm_check_match,
ThresholdStrategyNumber - are these good names?
2. I made trgm_check_match IMMUTABLE. Are there any other modifies that
should be there?
3. I defined % (text, pg_trgm_match) but didn't provide a commutator and
other helper procedures. Which of them should I implement?
4. Can I obtain query and nlimit with less code?
5. The attached patch replaced "res = (*(int *) &tmpsml == *(int *) &nlimit
|| tmpsml > nlimit);" with "res = (tmpsml >= nlimit);" to fix the bug on my
machine. I'm not sure whether that's the long-term fix we want to have.
It's just there to help me make progress with trigrams.

Thanks for help.

Cheers
Greg

Attachment Content-Type Size
pg_trgm_custom_threshold_in_gist.patch text/x-patch 5.7 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johan Thomsen 2016-06-20 14:22:19 pg_dump from a hot standby replication slave
Previous Message Adarsh Sharma 2016-06-20 13:11:27 Re: R: Vacuum full: alternatives?