Broad `EXPLAIN ANALYZE` guidance can execute write statements
Source references: 2The Skill directs the agent to use `EXPLAIN ANALYZE` before optimization without limiting it to read-only SELECT statements. In PostgreSQL, ANALYZE actually runs the analyzed statement rather than merely displaying its plan.
Using it with INSERT, UPDATE, DELETE, or another side-effecting statement can modify the connected database and may cause locks, trigger effects, or heavy load.
This is an active performance instruction to use `EXPLAIN ANALYZE`, without limiting it to read-only queries. PostgreSQL actually runs the analyzed statement, so applying it to UPDATE, DELETE, or INSERT could modify user data. The document says performance changes need human review, but does not explicitly prohibit executing this diagnostic command. Users can ask that it be restricted to SELECT statements or replaced with non-executing `EXPLAIN`.
- **`EXPLAIN ANALYZE`** before optimizing — measure, don't guess- **List columns explicitly** — avoid `SELECT *`, it fetches unnecessary data and breaks struct scanning when schema changesShow 1 other places
- **Avoid N+1 queries** — use `JOIN` or batch `WHERE id IN (...)` instead of querying in a loop- **Suggest improvements, never execute them** — performance changes (indexes, query rewrites, configuration) need human review in context of production data and workload patterns