Tag

WHERE 1=1

0 views collected around this technical thread.

Architect's Tech Stack
Architect's Tech Stack
Apr 2, 2025 · Databases

Understanding the Impact of WHERE 1=1 on MySQL Index Usage in MyBatis Queries

This article explains the purpose of using the always‑true condition “WHERE 1=1” in MyBatis SQL mappings, demonstrates through EXPLAIN queries that it does not prevent index usage, and recommends a cleaner MyBatis syntax that lets MySQL’s optimizer remove the redundant condition.

DatabaseIndexMyBatis
0 likes · 4 min read
Understanding the Impact of WHERE 1=1 on MySQL Index Usage in MyBatis Queries