Skip to content

Instantly share code, notes, and snippets.

@theothermattm
Created October 25, 2022 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theothermattm/84509cc03d7eacad1b56f4e1b7c21ae0 to your computer and use it in GitHub Desktop.
Save theothermattm/84509cc03d7eacad1b56f4e1b7c21ae0 to your computer and use it in GitHub Desktop.
Identify Sequential Scans in PostGreSQL
SELECT relname,
seq_scan,
seq_tup_read,
idx_scan,
idx_tup_fetch,
seq_tup_read / seq_scan
FROM pg_stat_user_tables
WHERE seq_scan > 0
ORDER BY seq_tup_read DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment