Let's say I have two db clients executing queries against a PostgreSQL cluster in parallel. I decide that I want one of them to use max_parallel_workers_per_gather at 2 and the other at 6.
So, client #1 will do
exec("SET max_parallel_workers_per_gather=2; // A
SELECT * FROM large_scan; // B
");
Client #2 will do
exec("SET max_parallel_workers_per_gather=6; // C
SELECT * FROM other_large_scan; // D
");
I am expecting sequence A->B->C->D so that both B and D execute at the same time with specified parameter. But is the sequence A->C->B->D possible? That would give 6 to both clients which is not what I want!
I am using SPI which I believe does not support asynchronous execution.