Re: Parallel threads in query - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Parallel threads in query
Date
Msg-id 20181101184037.c24cgma7y6f4kp3t@alap3.anarazel.de
Whole thread Raw
In response to Re: Parallel threads in query  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Parallel threads in query  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Hi,

On 2018-11-01 19:33:39 +0100, Tomas Vondra wrote:
> In theory, simulating such global limit should be possible using a bit
> of shared memory for the current total, per-process counter and probably
> some simple abort handling (say, just like contrib/openssl does using
> ResourceOwner).

Right.  I don't think you even need something resowner like, given that
anything using threads better make it absolutely absolutely impossible
that an error can escape.


> A better solution might be to start a bgworker managing a connection
> pool and forward the requests to it using IPC (and enforce the thread
> count limit there).

That doesn't really seem feasible for cases like this - after all, you'd
only use threads to work on individual rows if you wanted to parallelize
relatively granular per-row work or such. Adding cross-process IPC seems
like it'd make that perform badly.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Parallel threads in query
Next
From: Darafei "Komяpa" Praliaskouski
Date:
Subject: Re: Parallel threads in query