Skip to content

Instantly share code, notes, and snippets.

@jeremywadsack
Last active July 5, 2018 17:57
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 jeremywadsack/958dd193fc1ee500a53cf86ef841cb99 to your computer and use it in GitHub Desktop.
Save jeremywadsack/958dd193fc1ee500a53cf86ef841cb99 to your computer and use it in GitHub Desktop.
Metrics of postgres temporary file size and memory use
#!/usr/bin/env bash
# Records a line with the following space-separated fields
# date-time k-pg-tmp-work-mem k-pg-uss k-pg-pss k-pg-rss
cat <(du -sk /data/pgsql/9.5/data/base/pgsql_tmp/) <(/usr/local/bin/smem -u | grep postgres) | paste -s | awk '{print strftime("%FT%TZ") " " $1 " " $6 " " $7 " " $8}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment