psql -d appdb -c "EXPLAIN ANALYZE SELECT * FROM users WHERE id = 1;"
Plan and execute a query
EXPLAIN ANALYZE is valid shorthand for EXPLAIN (ANALYZE) and executes the statement to collect real timings and row counts. Use it on SELECTs in production; on write statements it really modifies data.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.