psql -d appdb -c "EXPLAIN SELECT * FROM users WHERE email = 'a@b.com';"

Category: Databases & SQL

psql -d appdb -c "EXPLAIN SELECT * FROM users WHERE email = 'a@b.com';"

Show a query plan without running it

Prints the plan the optimizer would use: scan type, estimated rows, and cost. Add ANALYZE to execute the query and show actual numbers. Plans are the first tool for index decisions.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.