Query plan node structure

In this recipe, we will be discussing the explain plan tree structure.

Getting ready

PostgreSQL generates a set of plans before choosing an optimal plan that it is going to execute, based on the collected statistics about the relations. That is, the plan we are going to get when we use the EXPLAIN command along with the SQL statement is the optimal plan for that query. We also used EXPLAIN statements extensively on previous topics, and now we are going to understand the plan structure, and the significance of each value in it.

How to do it…

Let's run a basic EXPLAIN query and evaluate it as follows:

benchmarksql=# EXPLAIN SELECT * FROM bmsql_customer WHERE c_id=0;                                                                                      
                                           QUERY PLAN                                           
------------------------------------------------------------------------------------------------ ...

Get PostgreSQL High Performance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.