1. Diagnosing Stale Statistics in PostgreSQL
Database AdministratorBackground
A user search query on a PostgreSQL database is taking several seconds despite having an index on the email column.
Problem
The query planner is choosing a sequential scan over an index scan because it estimates only 1,000 rows, but the table actually returns 95,000 rows.
How to use
Paste the PostgreSQL EXPLAIN ANALYZE JSON output into the tool, set the dialect to PostgreSQL, and input the SQL query.
{
"dialect": "postgresql",
"sql": "SELECT * FROM users WHERE lower(email) = '[email protected]'",
"maxDepth": 20
}Outcome
The visualizer highlights the Seq Scan node in red, flags the 95x row divergence, and suggests running ANALYZE to update table statistics.