On Mon, Jul 27, 2015 at 2:53 PM, Pavel Stehule <pavel.steh...@gmail.com> wrote: > I am trying to run parallel execution > > psql -At -c "select datname from pg_database" postgres | xargs -n 1 -P 3 > psql -c "select current_database()"
Put this in a shell script called run-psql: #!/bin/bash test $# = 0 && exit for f in "${@:1:$(($#-1))}"; do echo "$f" \; done | psql "${@:$#}" Then: psql -At -c "select datname from pg_database" postgres | xargs -n 1 -P 3 ./run-psql "select current_database()" "vacuum" "select 1" -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers