From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
---|---|
To: | Dominique Devienne <ddevienne(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org, andrew(at)tao11(dot)riddles(dot)org(dot)uk |
Subject: | Re: Keep specialized query pairs, or use single more general but more complex one |
Date: | 2025-02-24 17:36:10 |
Message-ID: | CAKAnmm+su9VJh5nQ3GTS88W5nJUyqFw-JrVuEj9q7mbSG0HCFw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Feb 24, 2025 at 11:50 AM Dominique Devienne <ddevienne(at)gmail(dot)com>
wrote:
> We lookup whether there's a list of aliases for "Allison". If there are,
> we send them in $3 as an array
of string (e.g. ['All', 'Alli', ...], and the first one matching (thanks to
> order by ord limit 1) is returned, if any.
>
Thanks, I understand it now. While the unnest will create a different plan,
it should fundamentally be the same. The join order will not matter. The
only consideration is if the unnest list grows very, very large, which
seems unlikely given your situation. And yes, it should be fine to set the
first name as the leading item in the array and only run a single query for
both cases.
As always, it's best to test on your data and your exact queries, but from
here it seems sane.
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
From | Date | Subject | |
---|---|---|---|
Next Message | Jeremy Schneider | 2025-02-24 19:56:20 | the postgr.es/m/MESSAGE_ID URL format |
Previous Message | Adrian Klaver | 2025-02-24 17:12:07 | Re: AW: AW: PGDG PostgreSQL Debian package: Question on conditions for creation of new cluster |