Re: Let's make PostgreSQL multi-threaded - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: Let's make PostgreSQL multi-threaded
Date
Msg-id 20230608194704.rybienokicvzocui@ddolgov.remote.csb
Whole thread Raw
In response to Re: Let's make PostgreSQL multi-threaded  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
> On Mon, Jun 05, 2023 at 06:43:54PM +0300, Heikki Linnakangas wrote:
> On 05/06/2023 11:28, Tristan Partin wrote:
> > > # Exposed PIDs
> > >
> > > We expose backend process PIDs to users in a few places.
> > > pg_stat_activity.pid and pg_terminate_backend(), for example. They need
> > > to be replaced, or we can assign a fake PID to each connection when
> > > running in multi-threaded mode.
> >
> > Would it be possible to just transparently slot in the thread ID
> > instead?
>
> Perhaps. It might break applications that use the PID directly with e.g.
> 'kill <PID>', though.

I think things are getting more interesting if some external resource
accounting like cgroups is taking place. From what I know cgroup v2 has
only few controllers that allow threaded granularity, and memory or io
controllers are not part of this list. Since Postgres is doing quite a
lot of different things, sometimes it makes sense to put different
limitations on different types of activity, e.g. to give more priority
to a certain critical internal job on the account of slowing down
backends. In the end it might be complicated or not possible to do that
for individual threads. Such cases are probably not very important from
the high level point of view, but could become an argument when deciding
what should be a process and what should be a thread.



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Let's make PostgreSQL multi-threaded
Next
From: Jan Wieck
Date:
Subject: Re: Named Prepared statement problems and possible solutions