I'm trying to run a series of postgres functions/stored-procedures that operate on separate tables in parallel using bash + psql as follows:

psql -d samples_20160612_0616 -c "select insert_function('2016-6-14 20:00'::timestamp, '2016-6-14 21:00'::timestamp)" &
psql -d samples_20160612_0616 -c "select insert_function('2016-6-15 19:00'::timestamp, '2016-6-15 20:00'::timestamp)" &
psql -d samples_20160612_0616 -c "select insert_function('2016-6-15 20:00'::timestamp, '2016-6-15 21:00'::timestamp)" &
psql -d samples_20160612_0616 -c "select insert_function('2016-6-16 19:00'::timestamp, '2016-6-16 20:00'::timestamp)" &
psql -d samples_20160612_0616 -c "select insert_function('2016-6-16 20:00'::timestamp, '2016-6-16 21:00'::timestamp)"

For some reason it seems that instead of being run in parallel as expected, the statements are run serially.

What am I doing wrong here? Shouldn't this run in parallel?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.