PostgreSQL – Generate Explain Plan

You can view the explain plan of any query by prefixing the query with EXPLAIN keyword as shown below:

EXPLAIN SELECT * from table1;
See also  PostgreSQL - Get first row within each group