skill
SQL query optimization
sql-query-optimization
Reads EXPLAIN plans on Postgres, MySQL or SQL Server and fixes indexes, selectivity, joins, CTEs and pagination.
When to use it
A query is slow on a relational database.
Technical description
Diagnoses and rewrites slow SQL on traditional engines (Postgres, MySQL, SQL Server, etc.) using EXPLAIN/EXPLAIN ANALYZE — indexing strategy, WHERE clause selectivity, avoiding functions on indexed columns, JOIN vs. subquery vs. CTE tradeoffs, and pagination. Use for any query slowness outside BigQuery, or when a query needs an index.