Alvaro Herrera <alvherre@surnet.cl> writes:
> I just noticed the HaveNFreeProcs routine is coded as a loop around the
> ProcGlobal struct members. I wonder if it's possible to use a simple
> check in procArray->numBackends against procArray->maxBackends instead?
It used to look like that, but now that numBackends includes prepared
transactions that's no longer a useful test. I think that the existing
coding is OK, because it's written to not loop more than
superuser_reserved_connections times, and it's hard to imagine anyone
would set that to more than half a dozen or so.
Also, that routine will disappear entirely if we agree to remove
commit_siblings (see nearby thread), so right at the moment I'm not very
concerned about improving it. If it is still there forty-eight hours
from now, let's talk about it then.
regards, tom lane