On Mon, Jul 6, 2020 at 5:37 AM Robins Tharakan <tharakan@xxxxxxxxx> wrote:
This need came up while reviewing generated SQL, where the need was to return true whenat 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.