@ -645,13 +645,13 @@ psql: could not connect to server: No such file or directory
<row>
<row>
<entry><varname>SEMMNI</></>
<entry><varname>SEMMNI</></>
<entry>Maximum number of semaphore identifiers (i.e., sets)</>
<entry>Maximum number of semaphore identifiers (i.e., sets)</>
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers + 4 ) / 16)</literal></>
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5 ) / 16)</literal></>
</row>
</row>
<row>
<row>
<entry><varname>SEMMNS</></>
<entry><varname>SEMMNS</></>
<entry>Maximum number of semaphores system-wide</>
<entry>Maximum number of semaphores system-wide</>
<entry><literal>ceil((max_connections + autovacuum_max_workers + 4 ) / 16) * 17</literal> plus room for other applications</>
<entry><literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5 ) / 16) * 17</literal> plus room for other applications</>
</row>
</row>
<row>
<row>
@ -699,20 +699,22 @@ psql: could not connect to server: No such file or directory
<para>
<para>
<productname>PostgreSQL</> uses one semaphore per allowed connection
<productname>PostgreSQL</> uses one semaphore per allowed connection
(<xref linkend="guc-max-connections">) and allowed autovacuum worker
(<xref linkend="guc-max-connections">), allowed autovacuum worker process
process (<xref linkend="guc-autovacuum-max-workers">), in sets of 16.
(<xref linkend="guc-autovacuum-max-workers">) and allowed background
process (<xref linkend="guc-max-worker-processes">), in sets of 16.
Each such set will
Each such set will
also contain a 17th semaphore which contains a <quote>magic
also contain a 17th semaphore which contains a <quote>magic
number</quote>, to detect collision with semaphore sets used by
number</quote>, to detect collision with semaphore sets used by
other applications. The maximum number of semaphores in the system
other applications. The maximum number of semaphores in the system
is set by <varname>SEMMNS</>, which consequently must be at least
is set by <varname>SEMMNS</>, which consequently must be at least
as high as <varname>max_connections</> plus
as high as <varname>max_connections</> plus
<varname>autovacuum_max_workers</>, plus one extra for each 16
<varname>autovacuum_max_workers</> plus <varname>max_worker_processes</>,
plus one extra for each 16
allowed connections plus workers (see the formula in <xref
allowed connections plus workers (see the formula in <xref
linkend="sysvipc-parameters">). The parameter <varname>SEMMNI</>
linkend="sysvipc-parameters">). The parameter <varname>SEMMNI</>
determines the limit on the number of semaphore sets that can
determines the limit on the number of semaphore sets that can
exist on the system at one time. Hence this parameter must be at
exist on the system at one time. Hence this parameter must be at
least <literal>ceil((max_connections + autovacuum_max_workers + 4 ) / 16)</>.
least <literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5 ) / 16)</>.
Lowering the number
Lowering the number
of allowed connections is a temporary workaround for failures,
of allowed connections is a temporary workaround for failures,
which are usually confusingly worded <quote>No space
which are usually confusingly worded <quote>No space