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.

continue reading on www.depesz.com

⚠️ This post links to an external website. ⚠️