Re: How to run in parallel in Postgres, EXECUTE_PARALLEL
От | Lars Aksel Opsahl |
---|---|
Тема | Re: How to run in parallel in Postgres, EXECUTE_PARALLEL |
Дата | |
Msg-id | HE1P189MB0266588071668BF3D5CF85479D590@HE1P189MB0266.EURP189.PROD.OUTLOOK.COM обсуждение исходный текст |
Ответ на | Re: How to run in parallel in Postgres (Laurenz Albe <laurenz.albe@cybertec.at>) |
Ответы |
Re: How to run in parallel in Postgres, EXECUTE_PARALLEL
|
Список | pgsql-performance |
>You cannot run several queries in parallel in a PostgreSQL function.
>
>You may want to have a look at PL/Proxy which might be used for things like that.
>
>Yours,
>Laurenz Albe
>--
>Cybertec | https://www.cybertec-postgresql.com
>You may want to have a look at PL/Proxy which might be used for things like that.
>
>Yours,
>Laurenz Albe
>--
>Cybertec | https://www.cybertec-postgresql.com
Hi Laurenz
The code below takes 3, seconds
DO
$body$
DECLARE
BEGIN
EXECUTE 'SELECT pg_sleep(1); SELECT pg_sleep(1); SELECT pg_sleep(1);';
END
$body$;
Do you or anybody know if there are any plans for a function call that support the calling structure below or something like it and that then could finish in 1 second ? (If you are calling a void function, the return value should not be any problem.)
DO
$body$
DECLARE
command_string_list text[3];
BEGIN
command_string_list[0] = 'SELECT pg_sleep(1)';
command_string_list[1] = 'SELECT pg_sleep(1)';
command_string_list[2] = 'SELECT pg_sleep(1)';
EXECUTE_PARALLEL command_string_list;
END
$body$;
The only way to this today as I understand it, is to open 3 new connections back to the database which you can be done in different ways.
If we had a parallel functions like the one above it's easier to make parallel sql without using complex scripts, java, python or other system.
Thanks.
Lars
В списке pgsql-performance по дате отправления: