0

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.

baceda9220
  • 41
  • 1
  • 4

1 Answers1

1

Setting a parameter in a session is generally local to that session. The execution order can be A->C->B->D, but that doesn't mean B will pay attention to what C did.

jjanes
  • 37,812
  • 5
  • 27
  • 34