From: | Lars Aksel Opsahl <Lars(dot)Opsahl(at)nibio(dot)no> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org> |
Subject: | Re: How to run in parallel in Postgres, EXECUTE_PARALLEL |
Date: | 2019-12-08 18:14:14 |
Message-ID: | HE1P189MB0266588071668BF3D5CF85479D590@HE1P189MB0266.EURP189.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
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
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2019-12-08 20:04:05 | Re: How to run in parallel in Postgres, EXECUTE_PARALLEL |
Previous Message | Tom Lane | 2019-12-08 15:42:00 | Re: query that canceled isnt logged |