Re: Want records to be UNIQUE. When searching for dupes, stop on first matching record.
Peter Geoghegan <[email protected]> Thu, 18 Apr 2019 15:37:25 -0700
| Newsgroups | gmane.comp.db.postgresql.novice |
|---|---|
| Message-ID | <CAH2-WznihtJ20uiCwwx2x-9ax3cpu3XZPhhs4S5xFAWp039RGw@mail.gmail.com> |
On Thu, Apr 18, 2019 at 1:15 PM Pól Ua Laoínecháin <[email protected]> wrote: > But what I really want (what I really, really want - apologies to the > Spice Girls) to know is, is there a query which will run and stop on > the first match? Using ANY, ALL or EXISTS or some construct like that? It sounds like you're looking for a loose index scan: https://wiki.postgresql.org/wiki/Loose_indexscan Unfortunately, Postgres doesn't have this capability just yet, so you'll have to simulate it in the manner described by the Wiki page. -- Peter Geoghegan