35 words, 1 min read
⚠️ This post links to an external website. ⚠️
Instead of using
COUNT(*)to find users without addresses, useNOT EXISTSfor better performance.COUNT(*)unnecessarily counts all rows before rejecting them, whileNOT EXISTSstops checking as soon as a match is found.
continue reading on www.depesz.com
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.