Skip to content

Commit

Permalink
Merge pull request #12 from payals/master
Browse files Browse the repository at this point in the history
Adding manual_vacuum.sh script
  • Loading branch information
payals committed Dec 7, 2016
2 parents e34a28d + 00ce554 commit 5ea31ea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/manual_vacuum.sh
@@ -0,0 +1,8 @@
# $1 database name
# $2 number of tables to vacuum
# $3 relfrozenxid threshold value


/opt/pgsql/bin/psql -d $1 -t -o /tmp/manual_vacuum_$1.sql -c "/*manual vacuum runs from cron*/ select 'vacuum analyze verbose ' || oid::regclass || ';' from pg_class where relkind in ('r', 't') and age(relfrozenxid) > $3 order by age(relfrozenxid) desc limit $2"

/opt/pgsql/bin/psql -d $1 -t -a -f /tmp/manual_vacuum_$1.sql > $HOME/logs/manual_vacuum_$1.log 2>&1

0 comments on commit 5ea31ea

Please sign in to comment.