Skip to content

Instantly share code, notes, and snippets.

@matheusoliveira
Created April 1, 2014 14:34
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 matheusoliveira/9915368 to your computer and use it in GitHub Desktop.
Save matheusoliveira/9915368 to your computer and use it in GitHub Desktop.
#!/bin/sh
JOBS=8
export PGDATABASE=<your database name>
psql -A0Xtc "SELECT oid::regclass::text FROM pg_class WHERE relkind IN ('r','m')" | xargs -P $JOBS -0 -I {} bash -c 'echo "`date`: started {}"; vacuumdb --analyze --table={} && echo "`date`: {}: OK" || echo "`date`: {}: FAILED!"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment