If your PostgreSQL query runs slowly, what should you do? How can you find out what has gone wrong, and how to optimize it? The “explain” command (and related ‘”explain analyze” command) tell you what the PostgreSQL query planner intends to do, and then (if you use the “analyze” option) executes the query, as well. The problem is that the output from “Explain” can often be cryptic to newcomers. In this talk, Josh Berkus introduces the “explain” command, and shows how database developers and administrators can use it to improve the speed of their queries.