ThatDev.Shparki

Code Snippet

PostgreSQL EXPLAIN ANALYZE

postgresql performance

Always use EXPLAIN ANALYZE to understand query performance.

EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM users WHERE email = 'test@example.com';

Key metrics to watch:

  • Actual time vs estimated
  • Buffer hits vs reads
  • Seq scan vs index scan