Re: Parallel query and number of connections.

2018-11-21 Thread Adrian Klaver
On 11/21/18 9:45 AM, Alessandro Aste wrote: Hi there, we are running postgresql 10.5 on a centos 7 server. We're seeing multiple connections (in pg_stat_activity) from our application with the same query , same user, same application_name, same query_start etc. We are 100% sure the query is

Re: Parallel Query - Can it be used within functions?

2018-02-28 Thread Michael Krüger
Ok, to close this thread. The problem is, that plpgsql function do seem to return data using a cursor. That fact is disabling parallel execution. So if we instead hand over the SQL to a function with e.g. a python body, then parallel execution is happening, because the data is first assembled in me

Re: Parallel Query - Can it be used within functions?

2018-02-28 Thread Michael Krüger
ah, and for completeness the simple python function I use for the test: create or replace function reports.generic_query_python(_sql text) RETURNS SETOF record LANGUAGE 'plpythonu' PARALLEL SAFE COST 100 VOLATILE ROWS 5000 AS $BODY$ return plpy.execute( _sql ) $BODY$; Michael Krü

Re: Parallel Query - Can it be used within functions?

2018-02-16 Thread Michael Krüger
Dear all, still same behavior with Postgres 10.2 ... Just as a reminder that the issue still exists. Regards, Michael Andreas Kretschmer schrieb am Di., 6. Feb. 2018 um 08:35 Uhr: > Hi, > > > Am 06.02.2018 um 08:24 schrieb Michael Krüger: > > create or replace function reports.generic_query(_

Re: Parallel Query - Can it be used within functions?

2018-02-05 Thread Andreas Kretschmer
Hi, Am 06.02.2018 um 08:24 schrieb Michael Krüger: create or replace function reports.generic_query(_sql text)   RETURNS SETOF record   LANGUAGE 'plpgsql'   PARALLEL SAFE   COST 100 there is an other parameter, parallel_setup_cost, with default = 1000. I think, you should set this parameter

Re: Parallel Query

2018-01-11 Thread Rafia Sabih
On Thu, Jan 11, 2018 at 12:24 PM, Krithika Venkatesh < krithikavenkates...@gmail.com> wrote: > Hi All, > > I was reading about parallel queries in postgresql 10. > > I came across the property max_parallel_workers_per_gather. It sets the > maximum number of workers that can be started by a single