pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Niels Jespersen <NJN@dst.dk>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: cpu-intensive immutable function and parallel scan
Date: Tue, 22 Jun 2021 09:29:28 -0400
Message-ID: <1713127.1624368568@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvrBHyx=1kng+QbcN7B=nbn8ZbxN0gvK35gXaea7sSFpiA@mail.gmail.com>
References: <c800b7a24a95419aaebf4e6ec31d8f57@dst.dk>
	<CAApHDvrBHyx=1kng+QbcN7B=nbn8ZbxN0gvK35gXaea7sSFpiA@mail.gmail.com>

David Rowley <dgrowleyml@gmail.com> writes:
> On Tue, 22 Jun 2021 at 19:06, Niels Jespersen <NJN@dst.dk> wrote:
>> I think I could achieve some speedup by parallelizing further, distributing the cpu-work among additional workers. But, how do I achive that best?

> You'll want to ensure max_parallel_workers_per_gather is set high
> enough and you have max_parallel_workers set to something high enough.
> You can then do:
> alter table t1 set (parallel_workers = <number of workers>);

Also, if you don't have a fairly high COST value set on the function,
try raising that to make the planner understand that it's expensive.
My recollection is that the amount of parallelism it goes for is partly
predicated on the estimated query cost.

			regards, tom lane





view thread (3+ messages)

Message-ID: <1713127.1624368568@sss.pgh.pa.us>
Permalink:  ../1713127.1624368568@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1713127.1624368568@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, NJN@dst.dk
  Subject: Re: cpu-intensive immutable function and parallel scan
  In-Reply-To: <1713127.1624368568@sss.pgh.pa.us>
  References: <c800b7a24a95419aaebf4e6ec31d8f57@dst.dk> <CAApHDvrBHyx=1kng+QbcN7B=nbn8ZbxN0gvK35gXaea7sSFpiA@mail.gmail.com> <1713127.1624368568@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox