Hi all!
I am trying to create basic experiment [1] analysing some data with plpgsql function in parallel.
I am able to aggregate data in parallel (6 workers) with pure SQL code (line 19) but as far as I put the same query (with some parametrization) into plpgsql function and run it via RETURN QUERY EXECUTE it doesn't run in parallel anymore (line 69). I would understand, that planner doesn't see into dynamic SQL being executed here or something like this.
But what is more surprising to me is, when I am trying to call that function 10x with different settings (line 84). It is also running on single CPU (probably according to 10x longer execution time) although the function is marked as PARALLEL SAFE.
I hope that at least the second example can be parallelized without any "conceptual" problems. Do I miss something?
And one last question: is it possible to see query plan which is created "inside" function call when query is actually executed?
Thank you in advance, Jiří.