Re: Apply LIMIT when computation is logically irrelevant - Mailing list pgsql-general

From Michael Lewis
Subject Re: Apply LIMIT when computation is logically irrelevant
Date
Msg-id CAHOFxGqETwver1DDy-pcZT3+Z8fw+yyiuLwCC-rNAF1rA9ayqg@mail.gmail.com
Whole thread Raw
In response to Apply LIMIT when computation is logically irrelevant  (Robins Tharakan <tharakan@gmail.com>)
List pgsql-general
On Mon, Jul 6, 2020 at 5:37 AM Robins Tharakan <tharakan@gmail.com> wrote:
This need came up while reviewing generated SQL, where the need was to return true when
at least one of two lists had a row.

Generated SQL... yep. That will happen. Manual SQL may be more work, but often has significant reward.

If you can change how the SQL is generated, I would expect that EXISTS would likely be more performant in your case, even if you need to do UNION ALL between the two current queries that potentially return true.

pgsql-general by date:

Previous
From: Sebastien Arod
Date:
Subject: Is postgres able to share sorts required by common partition window functions?
Next
From: Michael Lewis
Date:
Subject: Re: Is postgres able to share sorts required by common partition window functions?