I am currently working on building a pipeline using a PostgreSQL DB hosted by AWS RDS. In my pipeline, I have a stored procedure in PostgreSQL that is triggered by cron and used to executed other stored procedures. A summary of the procedure is below:
CREATE OR REPLACE PROCEDURE <postgres_schema>.main_procedure()
LANGUAGE plpgsql
AS $procedure$
begin
call <postgres_schema>.procedure_one();
call <postgres_schema>.procedure_two();
call <postgres_schema>.procedure_three();
END;
$procedure$
;
I was wondering, is there a way to execute the last two of these procedures (procedure_two, and procedure_three) in parallel, or at least asynchronously? I am trying to set up a process where the main_procedure() is called, procedure_one() is executed first, then once that procedure is complete procedure_two() and procedure_three() are called at the same time and execute in the background.