Erik Darling shows us a table having an existential crisis:
This is one of the most frustrating things I’ve seen from the optimizer in quite a while.
Here are a couple tables, with a foreign key between them:
Read on to see how EXISTS
and NOT EXISTS
handle an empty child table.