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

From Darafei "Komяpa" Praliaskouski
Subject Re: Parallel threads in query
Date
Msg-id CAC8Q8tKAvMKxDzvSNV_xBrjsxo8_Er-waYyFQUqsc3V40_pvbg@mail.gmail.com
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
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).

I would expect that this limit is already available and it's parallel worker limit. Basically, when start a new thread I would like to somehow consume a part of parallel worker limit - a thread is a kind of parallel worker, from user's perspective. If I have 4 cores and Postgres already started 4 parallel workers, I don't really want to start 4 threads for each of them, or 4 for one of them and 1 for each of the rest, if I manage that separately from parallel worker limit.

IPC and co - that's another question and out of scope for this one. Since OpenMP allows to write multithreaded code by just adding more #pragma around loops, I don't want to reinvent that part of infrastructure.
--
Darafei Praliaskouski
Support me: http://patreon.com/komzpa

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Parallel threads in query
Next
From: Tomas Vondra
Date:
Subject: Re: Parallel threads in query