Last active
February 6, 2017 19:18
-
-
Save saicitus/f6d40a108a4fa16b5af7b974467ffd80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Analyzes a specific distributed table | |
export PGHOST=... | |
export PGUSER=citus | |
export PGPASSWORD=... | |
#export PGSSLMODE=require | |
export PGDATABASE=citus | |
export TABLE_NAME=<table_name> | |
export PARALLEL_FACTOR=4 | |
psql -tA -F" " -c "SELECT logicalrelid::regclass||'_'||s.shardid, \ | |
nodename, nodeport FROM pg_dist_shard s JOIN pg_dist_shard_placement p ON (s.shardid = p.shardid) \ | |
WHERE logicalrelid::regclass = '$TABLE_NAME'::regclass;" | | |
xargs -n 3 -P $PARALLEL_FACTOR sh -c "psql -h \$1 -p \$2 -c \"VACUUM \$0\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment