Optimizing Existence Checks: Use SELECT 1 LIMIT 1 Instead of COUNT(*)
The article explains why using SELECT 1 with LIMIT 1 to test for record existence is more efficient than counting rows with SELECT count(*), and shows how to rewrite both SQL and Java code for better performance.
