Skip to content

Instantly share code, notes, and snippets.

@saicitus
Last active June 6, 2017 22:27
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 saicitus/a63d81b42a181df24b52a177fcc18426 to your computer and use it in GitHub Desktop.
Save saicitus/a63d81b42a181df24b52a177fcc18426 to your computer and use it in GitHub Desktop.
-- Replace "<*>" with real names
psql -h <coordinator_host> -p <coordinator_port> -tA -F" " -c "SELECT nodename, nodeport, shardid FROM pg_dist_shard
JOIN pg_dist_shard_placement USING (shardid) WHERE logicalrelid = '<table_name>'::regclass" |
xargs -n 3 -P8 sh -c "psql -h \$0 -p \$1 -c \"CLUSTER <table_name>_\$2 USING <table_name>_<index_name>_\$2;\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment