TLDR Web Dev · OPINIONS & ADVICE
SQL BEST PRACTICES – DON'T COMPARE COUNT(*) WITH 0
Summary from the TLDR Web Dev newsletter
Instead of using `COUNT(*)` to find users without addresses, use `NOT EXISTS` for better performance. `COUNT(*)` unnecessarily counts all rows before rejecting them, while `NOT EXISTS` stops checking as soon as a match is found.