[pg_trgm] Per-query set_limit()

From: Greg Navis <contact(at)gregnavis(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: [pg_trgm] Per-query set_limit()
Date: 2016-06-03 10:43:02
Message-ID: CAA6WWt-1Z=vVyj3f4wD57ZWuOz39+mJ-6H3mDTAwOVVTBcVcZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey!

I'd like to call `set_limit` on a per-query basis, i.e. searching for
restaurants in a given city should use 0.4 and searching for cinemas by
name should use 0.2. I can accomplish this with:

```
SELECT set_limit(0.2);
SELECT * FROM cinemas WHERE name % ?;
```

(similarly for restaurants).

My question is: is there a better way?

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Artur Zakirov 2016-06-03 10:51:38 Re: [pg_trgm] Making similarity(?, ?) < ? use an index
Previous Message Greg Navis 2016-06-03 10:35:38 [pg_trgm] Making similarity(?, ?) < ? use an index