Re: Let's make PostgreSQL multi-threaded

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Hannu Krosing <hannuk(at)google(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Let's make PostgreSQL multi-threaded
Date: 2023-06-12 22:24:04
Message-ID: ZIebBIgkZVMd2Fbc@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 12, 2023 at 12:24:30PM -0700, Andres Freund wrote:
> Those points seems pretty much unrelated to the potential gains from switching
> to a threading model. The main advantages are:
>
> 1) We'd gain from being able to share state more efficiently (using normal
> pointers) and more dynamically (not needing to pre-allocate). That'd remove
> a good amount of complexity. As an example, consider the work we need to do
> to ferry tuples from one process to another. Even if we just continue to
> use shm_mq, in a threading world we could just put a pointer in the queue,
> but have the tuple data be shared between the processes etc.
>
> Eventually this could include removing the 1:1 connection<->process/thread
> model. That's possible to do with processes as well, but considerably
> harder.
>
> 2) Making context switches cheaper / sharing more resources at the OS and
> hardware level.

Yes. FWIW, while reading the thread, parallel workers stroke me as
the first area that would benefit from all that. Could it be easier
to figure out the incremental pieces if working on a new node doing a
Gather based on threads, for instance?
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-06-12 23:05:39 Re: Atomic ops for unlogged LSN
Previous Message Tristan Partin 2023-06-12 21:43:29 Re: Meson build updates