Parallel workers via functions? - Mailing list pgsql-general

From Jim Vanns
Subject Parallel workers via functions?
Date
Msg-id CAH7vdhPr9BJ2TjbVU0RepN92eUFmWorukAGEyhBqpx8gF67xdQ@mail.gmail.com
Whole thread Raw
Responses Re: Parallel workers via functions?
List pgsql-general
Apologies for the rushed question ...

If I have a function that is marked 'stable parallel safe' and returns
a table, can a calling function or procedure (marked volatile parallel
unsafe) still take advantage of the parallel workers from the first
function - as the data source. I.e.

func_a(); // selects, returns table, parallel safe
func_b() {
   insert into foo
   select * from func_a(); // Will func_a still execute parallel
workers to fetch the data?
}

Or even if func_b() uses 'create temporary table as select * from
func_a()' and then insert?

I ask because when I simply call func_a() from a psql shell, I see the
parallel workers run and everything is nice and swift. But when called
from a data-modifying function like func_b(), no workers are spawned
:( Even from the read-part of the code.

Are there differences in functions vs. stored procedures that might
affect the behaviour of the planner to disregard workers?

Cheers

Jim

-- 
Jim Vanns
Principal Production Engineer
Industrial Light & Magic, London



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: FATAL: could not send data to WAL stream: lost synchronization with server: got message type "0", length 892351284
Next
From: Shaheed Haque
Date:
Subject: Content of pg_publication using a local connection versus network connection?