Hacker News new | past | comments | ask | show | jobs | submit login

Bad execution plans are almost always the result of a missing or incompatible index, bad table statistics (corrected by running ANALYZE) or bad server configuration (corrected by adjusting memory parameters and cost parameters).

The query planner evaluates multiple query plans, and chooses the one with the lowest cost based. If that results in the wrong plan, you should attempt to correct the query planner input (that is, the statistics and the server configuration, and possibly the tables and their indices) so that it can better evaluate the possible query plans.

EXPLAIN is a great tool to debug query plans.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: