parallel plpgsql function

Поиск
Список
Период
Сортировка
От Jiří Fejfar
Тема parallel plpgsql function
Дата
Msg-id CA+8wVNXBxNQOcLOzY2N80yvTE_+w_zRqQu30Jp=mMd=w57defA@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
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ří.

[1] https://gitlab.com/snippets/1806432

В списке pgsql-general по дате отправления:

Предыдущее
От: "Gunnar \"Nick\" Bluth"
Дата:
Сообщение: Re: SELECT of pseudo hex value gives unexpected result
Следующее
От: Stefan Keller
Дата:
Сообщение: Re: How to set parameters in 'options'?