skip to content
Alvin Lucillo

PostgreSQL EXPLAIN Command

/ 1 min read

💻 Tech

In PostgreSQL, EXPLAIN command produces an execution plan, which is shows how a query will be executed in a tree-like structure. This helps with understanding how the query is being executed and how to optimize it. For example, it can show what type of scan is being used, how indexes are being used, and how the data is being joined.

EXPLAIN SELECT * FROM users WHERE id = 1;

For more details, you may read this documentation: https://www.postgresql.org/docs/current/using-explain.html