Tom Lane wrote:
>
> This approach would only work as far as saving the fork() call itself,
> not the backend setup time. Not sure it's worth the trouble. I doubt
> that the fork itself is a huge component of our start time; it's setting
> up all the catalog caches and so forth that's expensive.
On Unix, yeah, but on Windows, VMS, MPE/iX, possibly others, forking is
expensive. Even on Unix, you're not losing anything by this architecture.
The simple solution is to have wait on separate sockets and add a redirect
capability to the protocol. The program would be:
If the clients wants the database I have open, great, we're in business
else if the client supports redirect, do redirect
else if I can pass file descriptor on this OS, pass file descriptor to the right process
else throw away what we've done and open the right database.
Simple! It's just a small matter of programming.