Overview
Database query generation fails when queries are written for correctness without considering performance — no LIMIT on list queries, cartesian products from missing JOIN conditions, N+1 queries from lazy loading, and string interpolation that creates SQL injection vulnerabilities. A query that works correctly in development with 100 rows can destroy production performance with 10 million rows.
The Database Query Generation Framework writes queries that are parameterized, index-aware, paginated, and includes the EXPLAIN analysis that confirms the query plan before deployment.