Provides EXPLAIN ANALYZE workflow for identifying missing indexes, sequential scans, and query plan issues.
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
execute_sql access to the target database.supabase-mcp-verification tile MUST be installed and passing. See .skills/supabase-mcp-verification.md.db-diagnostics-inspection tile MUST be available for follow-up index analysis. See .skills/db-diagnostics-inspection.md.EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON).execute_sql. Example call:
EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)
SELECT orders.id, customers.name
FROM orders
JOIN customers ON orders.customer_id = customers.id
WHERE orders.status = 'pending';{
"Node Type": "Seq Scan",
"Relation Name": "orders",
"Filter": "(status = 'pending')",
"Rows Removed by Filter": 48200,
"Plan Rows": 100,
"Actual Rows": 312,
"Shared Hit Blocks": 5,
"Shared Read Blocks": 980
}EXPLAIN ANALYZE on destructive statements (DELETE, UPDATE, INSERT) in production without explicit user approval — these execute the query."Node Type": "Seq Scan".WHERE or JOIN column, flag it as a missing index.db-diagnostics-inspection when: there are multiple Seq Scans across several tables, existing indexes are consistently ignored by the planner, or you need a broader audit of index health and bloat across the schema.Before/After Example:
Seq Scan on orders with Filter: (status = 'pending'), scanning 50 000 rows to return 312.CREATE INDEX CONCURRENTLY idx_orders_status ON orders (status);Index Scan using idx_orders_status on orders, returning 312 rows with no full-table scan."Plan Rows" to "Actual Rows" at each node.ANALYZE table_name.db-diagnostics-inspection when stale statistics appear across many tables, suggesting a systemic autovacuum or maintenance issue rather than a single-query problem."Node Type": "Nested Loop" node, flag it if the inner relation's "Actual Rows" exceeds 1000 — recommend a Hash Join, Merge Join, or a join-column index to enable an Index Nested Loop.Shared Read Blocks / (Shared Hit Blocks + Shared Read Blocks).ANALYZE table_name when stale statistics are also present; recommend reviewing shared_buffers configuration when the ratio is high across multiple unrelated nodes.CREATE INDEX CONCURRENTLY idx_<table>_<col> ON <table> (<col>);ANALYZE table_name;CREATE INDEX without CONCURRENTLY on production tables.EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) after applying fixes.db-diagnostics-inspection for deeper schema-level analysis.