|
|
Subscribe / Log in / New account

PostgreSQL reconsiders its process-based model

PostgreSQL reconsiders its process-based model

Posted Jun 22, 2023 14:42 UTC (Thu) by kleptog (subscriber, #1183)
Parent article: PostgreSQL reconsiders its process-based model

This is a big change, I wonder how this will go. For me the process model makes it easier to convince people that when a client connects to a single database then they cannot, even if there are bugs, accidentally access data from other database. Corruption cannot "leak". In some contexts this separation is quite important. I can also imagine that hosting providers are not enthused by different customers connecting to the same cluster being mixed in a single process where.

But nothing is final of course. There are of course benefits to be had too. But if this means I need to start managing more clusters then of course it's not helping at all. I guess it's a question of trust though in the end. And I do trust that if the postgres developers release a threaded version, then it will work as advertised.

That said, I wonder if a hybrid scheme is possible, where you can run multiple sessions threaded in parallel in a single process but limited to a single database. Then something like pgbouncer in front of it can handle the multiplexing. You could even add restrictions like: within a single process the GUCs must be the same and they all use the same loadable objects. I feel this would solve a lot of the use-cases where they're worried about the number of simultaneous processes. OTOH might be even more complex.

But whatever they do, the very best of luck.


to post comments

PostgreSQL reconsiders its process-based model

Posted Jun 22, 2023 16:15 UTC (Thu) by Lennie (subscriber, #49641) [Link] (2 responses)

You do know this process can just connect to an other database ?

Same connection to PostgreSQL:

postgres=# \c testdb
You are now connected to database "testdb" as user "postgres".
testdb=#

PostgreSQL reconsiders its process-based model

Posted Jun 23, 2023 0:18 UTC (Fri) by andresfreund (subscriber, #69562) [Link] (1 responses)

> You do know this process can just connect to an other database ?
> ...
> postgres=# \c testdb

That actually establishes a new connection from within psql and thus connects to a backend process. You can observe that with SELECT pg_backend_pid();.

PostgreSQL reconsiders its process-based model

Posted Jun 24, 2023 11:26 UTC (Sat) by Lennie (subscriber, #49641) [Link]

Seems I checked it wrong, it's the same TCP connection.

PostgreSQL reconsiders its process-based model

Posted Jun 23, 2023 3:01 UTC (Fri) by willmo (subscriber, #82093) [Link]

> when a client connects to a single database then they cannot, even if there are bugs, accidentally access data from other database.

I think it depends on the bugs, and what you mean by “accidentally”. :-) I don’t think Postgres sandboxes the backend processes to protect against an attacker who gains arbitrary code execution? Still, it seems fair to assume that the practical impact of some bugs in some circumstances would be greater in a threaded model.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds