Home Explore Blog CI



postgresql

11th chunk of `doc/src/sgml/runtime.sgml`
6c75004ef2de10718bbaab84ed7fa0aed67d115e1bb6a8910000000100000fa0
 has its own implementation of
    these features and is not discussed here.
   </para>

   <para>
    By default, <productname>PostgreSQL</productname> allocates
    a very small amount of System V shared memory, as well as a much larger
    amount of anonymous <function>mmap</function> shared memory.
    Alternatively, a single large System V shared memory region can be used
    (see <xref linkend="guc-shared-memory-type"/>).

    In addition a significant number of semaphores, which can be either
    System V or POSIX style, are created at server startup.  Currently,
    POSIX semaphores are used on Linux and FreeBSD systems while other
    platforms use System V semaphores.
   </para>

   <para>
    System V <acronym>IPC</acronym> features are typically constrained by
    system-wide allocation limits.
    When <productname>PostgreSQL</productname> exceeds one of these limits,
    the server will refuse to start and
    should leave an instructive error message describing the problem
    and what to do about it. (See also <xref
    linkend="server-start-failures"/>.) The relevant kernel
    parameters are named consistently across different systems; <xref
    linkend="sysvipc-parameters"/> gives an overview. The methods to set
    them, however, vary. Suggestions for some platforms are given below.
   </para>

   <table id="sysvipc-parameters">
    <title><systemitem class="osname">System V</systemitem> <acronym>IPC</acronym> Parameters</title>

    <tgroup cols="3">
     <colspec colname="col1" colwidth="1*"/>
     <colspec colname="col2" colwidth="3*"/>
     <colspec colname="col3" colwidth="3*"/>
     <thead>
      <row>
       <entry>Name</entry>
       <entry>Description</entry>
       <entry>Values needed to run one <productname>PostgreSQL</productname> instance</entry>
      </row>
     </thead>

     <tbody>
      <row>
       <entry><varname>SHMMAX</varname></entry>
       <entry>Maximum size of shared memory segment (bytes)</entry>
       <entry>at least 1kB, but the default is usually much higher</entry>
      </row>

      <row>
       <entry><varname>SHMMIN</varname></entry>
       <entry>Minimum size of shared memory segment (bytes)</entry>
       <entry>1</entry>
      </row>

      <row>
       <entry><varname>SHMALL</varname></entry>
       <entry>Total amount of shared memory available (bytes or pages)</entry>
       <entry>same as <varname>SHMMAX</varname> if bytes,
        or <literal>ceil(SHMMAX/PAGE_SIZE)</literal> if pages,
        plus room for other applications</entry>
      </row>

      <row>
       <entry><varname>SHMSEG</varname></entry>
       <entry>Maximum number of shared memory segments per process</entry>
       <entry>only 1 segment is needed, but the default is much higher</entry>
      </row>

       <row>
        <entry><varname>SHMMNI</varname></entry>
        <entry>Maximum number of shared memory segments system-wide</entry>
        <entry>like <varname>SHMSEG</varname> plus room for other applications</entry>
       </row>

       <row>
        <entry><varname>SEMMNI</varname></entry>
        <entry>Maximum number of semaphore identifiers (i.e., sets)</entry>
        <entry>at least <literal>ceil(num_os_semaphores / 16)</literal> plus room for other applications</entry>
       </row>

       <row>
        <entry><varname>SEMMNS</varname></entry>
        <entry>Maximum number of semaphores system-wide</entry>
        <entry><literal>ceil(num_os_semaphores / 16) * 17</literal> plus room for other applications</entry>
       </row>

       <row>
        <entry><varname>SEMMSL</varname></entry>
        <entry>Maximum number of semaphores per set</entry>
        <entry>at least 17</entry>
       </row>

       <row>
        <entry><varname>SEMMAP</varname></entry>
        <entry>Number of entries in semaphore map</entry>
        <entry>see text</entry>
       </row>

       <row>
        <entry><varname>SEMVMX</varname></entry>
        <entry>Maximum value of semaphore</entry>
       

Title: System V IPC Parameters for PostgreSQL
Summary
This section discusses the system-wide allocation limits for System V IPC features, such as shared memory and semaphores, which are required by PostgreSQL, and provides a table listing the relevant kernel parameters, including their descriptions and recommended values for running a PostgreSQL instance.