How to Read PostgreSQL Query Plans
This text introduces how to read and understand the output of EXPLAIN commands, which are used for query planning in PostgreSQL databases. It provides three examples using a flight bookings database publicly available from PostgresPro. The first example demonstrates the use of the EXPLAIN command on a trivial query to select everything from a table. The second example uses EXPLAIN ANALYZE, which executes the query and shows the actual execution time in milliseconds. The third example adds the BUFFERS parameter to the EXPLAIN command, showing information about how many pages are read from cache and how many are read from disk. It also explains startup and execution costs associated with nodes in a query plan tree.
Company
Airbyte
Date published
May 16, 2024
Author(s)
Arun Nanda
Word count
2357
Hacker News points
None found.
Language
English