Re: How to run in parallel in Postgres, EXECUTE_PARALLEL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux