4 ms·
> So, Postgres is using process-per-connection model. Can some explain why this is? And why not something like thread-per-connection? Thread vs process under L
by outworlder 5y ago
> So, Postgres is using process-per-connection model. Can some explain why this is? And why not something like thread-per-connection?
Thread vs process under Linux is kind of a potato potato thing. They are essentially the same thing - based on the flags provided when you create the process, you can indicate if you want things like shared memory or not. But they are ultimately the same construct, with similar overhead. Plus, fork() is incredibly useful.
It makes sense, for such an important piece of software, to minimize shared memory.
- mike_hock 5y agoAlso, Postgres predates CLONE_THREAD, so when Postgres was created, the distinction was even more potato-potahto than it is today.
- boomer918 5y agoAre you certain? I thought threads are much more lightweight and also access memory faster because there is no CoW overhead (mutexes permitting). E.g. why nginx is much faster and lighter than Apache and MySQL connections are cheaper and faster to create than Pg.