I am experiencing problems with parallelism due to max_parallel_workers_per_gather

I have set the following parameters in postgresql.conf:

max_worker_processes = 64
max_parallel_workers = 32
max_parallel_workers_per_gather =32

though, SHOW max_parallel_workers_per_gather; returns 0, unless I set the parameter within current session.

EXPLAIN returns Workers Planned only if I set SET max_parallel_workers_per_gather to 32; within the explained query.

Though, I can not set the parameter with every query, since I work through python sqlalchemy

postgres db works within docker container

How to set the max_parallel_workers_per_gather permanently?

  • 2
    Did you reload the configuration after changing postgresql.conf
    – user1822
    Aug 31, 2020 at 13:19
  • 1
    And, after reloading, did you check the log file if it worked? Aug 31, 2020 at 13:20
  • 1
    And check the "source" column from "pg_setttings"
    – jjanes
    Aug 31, 2020 at 13:21
  • 1
    OK, so that will override postgresql.conf, and was done by something like alter user foobar set max_parallel_workers_per_gather = 0;
    – jjanes
    Aug 31, 2020 at 13:45
  • 1
    This indicates that your application is using the postgres user to connect to the database. That is s a really bad idea. You shouldn't be using the superuser from within your application- that is a huge security risk!
    – user1822
    Aug 31, 2020 at 13:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.