Re: Inefficient query plan for SELECT ... EXCEPT ... - Mailing list pgsql-general

From David G. Johnston
Subject Re: Inefficient query plan for SELECT ... EXCEPT ...
Date
Msg-id CAKFQuwYQUiqx5v96Xq6nAOf9sSwXntP8hwnPBjwiQbJjGiLPMA@mail.gmail.com
Whole thread Raw
In response to Inefficient query plan for SELECT ... EXCEPT ...  (Dimitrios Apostolou <jimis@gmx.net>)
List pgsql-general
On Tue, Oct 31, 2023 at 3:41 PM Dimitrios Apostolou <jimis@gmx.net> wrote:

Is this worth a bug report? I can file one if the issue is not known.
Or am I misunderstanding the implications of the SELECT-EXCEPT query?

In the meantime I have replaced the query with a LEFT OUTER JOIN which
performs much better,

I'd expect a NOT EXISTS query would also perform well and more accurately reflect what you seem to be wanting here.

I could see maybe optimizing away the second independent query if the first produces zero rows but it also doesn't seem like that productive an optimization to attempt.

David J.

pgsql-general by date:

Previous
From: Dimitrios Apostolou
Date:
Subject: Inefficient query plan for SELECT ... EXCEPT ...
Next
From: David Rowley
Date:
Subject: Re: Inefficient query plan for SELECT ... EXCEPT ...