"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes: > Reserve last few process slots for super-user if max_connections > reached Another minor coding suggestion: + /* + * Check a normal user hasn't connected to a superuser reserved slot. + * Do this here since we need the user information and that only happens + * after we've started bringing the shared memory online. So we wait + * until we've registered exit handlers and potentially shut an open + * transaction down for an as safety conscious rejection as possible. + */ + if (!superuser() && MyBackendId > MaxBackends - ReservedBackends) + elog(ERROR, "Normal user limit exceeded"); This would be more efficient if you placed the superuser() test after the BackendId test, as it is both more expensive to evaluate and more likely to be true. Cheers, Neil -- Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера