Re: Can functions containing a CTE be PARALLEL SAFE?

From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Can functions containing a CTE be PARALLEL SAFE?
Date: 2019-10-17 13:13:24
Message-ID: CAGHENJ6dF12ewNS=brvGfafi8tPu6WQ2usati7Occqni-htSnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Makes sense, thanks for the confirmation.
Maybe clarify in the manual?

Regards
Erwin

On Thu, Oct 17, 2019 at 11:20 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Erwin Brandstetter <brsaweda(at)gmail(dot)com> writes:
> >> The following operations are always parallel restricted.
> >> - Scans of common table expressions (CTEs).
>
> > Now I am unsure whether I can use `PARALLEL SAFE` for functions
> containing
> > a CTE (while fulfilling all other criteria)?
>
> AFAIR, the reason for treating CTEs as parallel restricted is simply to
> guarantee single evaluation of the CTE. Within a function, that would
> only matter per-function-execution, so I can't see why a function
> containing such a query couldn't be pushed down to workers for execution.
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lizeth Solis Aramayo 2019-10-17 13:46:42 RE: CVE-2018-1058
Previous Message Tom Lane 2019-10-17 12:40:15 Re: PostgreSQL memory usage