Re: Request more documentation for incompatibility of parallelism and plpgsql exec_run_select

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Mark Dilger <hornschnorter(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Request more documentation for incompatibility of parallelism and plpgsql exec_run_select
Date: 2017-08-11 15:45:36
Message-ID: CA+TgmoYAFA64qNOkKXh3wYgEDYz7L3g3CJqP0o3JMK7WxkW89Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 10, 2017 at 6:21 PM, Mark Dilger <hornschnorter(at)gmail(dot)com> wrote:
> That misses the point I was making. I was suggesting a syntax where
> the caller promises to use all rows without stopping short, and the
> database performance problems of having a bunch of parallel workers
> suspended in mid query is simply the caller's problem if the caller does
> not honor the contract.

I understand. My point is: that isn't sufficient to solve the
problem. It's not a question of whether the caller uses all the
tuples, but whether the caller gets to do anything else while the
tuples are being generated, so to make it work, you'd have to first
run the parallel query to completion and buffer all the tuples in
memory and *only then* begin iterating over them and running the
user-supplied code. You can't run the parallel query until it
produces a tuple, then do the code inside the loop, then run it until
the next tuple shows up, etc.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-08-11 15:59:14 Re: [postgresql 10 beta3] unrecognized node type: 90
Previous Message Tom Lane 2017-08-11 15:45:31 Re: Patches I'm thinking of pushing shortly