Re: max_connections - Mailing list pgsql-performance

From Pavel Stehule
Subject Re: max_connections
Date
Msg-id CAFj8pRAiVDnJpcxxSss1uy_LEDGy+pS9b2dx6dkqV+nF_=uAXw@mail.gmail.com
Whole thread Raw
In response to max_connections  (Joao Junior <jcoj2006@gmail.com>)
List pgsql-performance
Hi

út 22. 10. 2019 v 14:28 odesílatel Joao Junior <jcoj2006@gmail.com> napsal:
Hi, 
I am not sure if here is the best place to post this.
I would like to know why  max_connections parameter can't be changed without a restart. I know that it is a postmaster's context parameter. 
Which  PostgreSQL's subsystems, structures and OS kernel parameters  should be affected to support this change??

The max_connections is used more time inside PostgreSQL source code - typically for dimensions arrays where one field is per session.

You can search in source code the variable "MaxConnections". It's used for informations about sessions (processes), about transactions, locks, ..

Unfortunately, lot of these arrays are allocated in shared memory. For shared memory has Postgres special coding standards - almost all memory is allocated in startup time, and newer released. It is very simple to manage memory with these rules. It is fast, and there are not any risk of memory leaks. But related limits requires restart. Usually it is not a problem. So necessity of restart after change of max_connection is related to simple but very robust share memory management.

Regards

Pavel


Thanks!

pgsql-performance by date:

Previous
From: Joao Junior
Date:
Subject: max_connections
Next
From: Grégoire de Turckheim
Date:
Subject: Notifications within triggers seem to compromise performance