PostgreSQL Execution Plan Explained

What Is an Execution Plan?

An execution plan shows how PostgreSQL executes a query.

Example

EXPLAIN ANALYZE SELECT * FROM orders;

Sequential Scan vs Index Scan

Sequential scan reads entire table, index scan reads only relevant rows.