July 2005
Intermediate to advanced
1032 pages
27h 10m
English
The EXPLAIN command only shows you the execution plan that PostgreSQL considered to be the least expensive. Unfortunately, you can't convince PostgreSQL to show the other execution plans that it considered. The most common performance question that we hear is “why didn't the database use my index?” If you could see all the alternatives, you could usually (but not always) answer that question.
When the optimizer generates a set of execution plans for a query, it starts by generating a set of plans that traverse each base table involved in the query. For a single-table query, there is only one base table and the planner generates a single set of execution plans. For a multitable query (a join), the planner ...
Read now
Unlock full access