EXPLAIN: Understand the query plan
No video of the event yet, sorry!
Many times we were amazed that why is my query running slow? And couldn't get to know exactly what's an issue. However, if we know the plan of a query, then life becomes easy. For that EXPLAIN is our handy tool which gives us a query-plan for the given statement. For good performance and tuning the system, choosing the right plan is very necessary. PostgreSQL planner is designed such a way that it analyzes the query structure, data and from the statistics, it chooses the best plan for the query. Moreover, if we are able to read and understand that plan correctly, then by tweaking a few of the server parameters we can have a better plan to execute the same query.
In this talk, I will mainly focus on reading and understanding the EXPLAIN and EXPLAIN ANALYZE output which will help us to restructure the schema definition or change the server parameters for better results. I will also go through the various options available with these commands.
- 45 min
- PGConf India, 2019
- Database Administration