EXPLAIN plan
The EXPLAIN command shows how the database plans to execute your query — which indexes, joins, scans.
The tool for finding missing indexes and bad JOIN orders. EXPLAIN ANALYZE actually runs the query and shows real timings. "Seq Scan" on a large table = probably missing index. PgMustard and pgAnalyze visualise Postgres plans.