Home Explore Blog CI



postgresql

15th chunk of `doc/src/sgml/runtime.sgml`
c24031637428ddb07b6ebb66eefffe8cf5faa5464e658d3b0000000100000fb6
    <listitem>
       <para>
        The default shared memory settings are usually good enough, unless
        you have set <literal>shared_memory_type</literal> to <literal>sysv</literal>.
        However, you will need to
        increase <literal>kern.seminfo.semmni</literal>
        and <literal>kern.seminfo.semmns</literal>,
        as <systemitem class="osname">OpenBSD</systemitem>'s default settings
        for these are unworkably small.
       </para>

       <para>
        IPC parameters can be adjusted using <command>sysctl</command>,
        for example:
<screen>
<prompt>#</prompt> <userinput>sysctl kern.seminfo.semmni=100</userinput>
</screen>
        To make these settings persist over reboots, modify
        <filename>/etc/sysctl.conf</filename>.
       </para>

      </listitem>
     </varlistentry>

     <varlistentry>
      <term><systemitem class="osname">Linux</systemitem>
      <indexterm><primary>Linux</primary><secondary>IPC configuration</secondary></indexterm>
      </term>
      <listitem>
       <para>
        The default shared memory settings are usually good enough, unless
        you have set <literal>shared_memory_type</literal> to <literal>sysv</literal>,
        and even then only on older kernel versions that shipped with low defaults.
        System V semaphores are not used on this platform.
       </para>

       <para>
        The shared memory size settings can be changed via the
        <command>sysctl</command> interface.  For example, to allow 16 GB:
<screen>
<prompt>$</prompt> <userinput>sysctl -w kernel.shmmax=17179869184</userinput>
<prompt>$</prompt> <userinput>sysctl -w kernel.shmall=4194304</userinput>
</screen>
        To make these settings persist over reboots, see
        <filename>/etc/sysctl.conf</filename>.
       </para>

      </listitem>
     </varlistentry>


     <varlistentry>
      <term><systemitem class="osname">macOS</systemitem>
      <indexterm><primary>macOS</primary><secondary>IPC configuration</secondary></indexterm>
      </term>
      <listitem>
       <para>
        The default shared memory and semaphore settings are usually good enough, unless
        you have set <literal>shared_memory_type</literal> to <literal>sysv</literal>.
       </para>
       <para>
        The recommended method for configuring shared memory in macOS
        is to create a file named <filename>/etc/sysctl.conf</filename>,
        containing variable assignments such as:
<programlisting>
kern.sysv.shmmax=4194304
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.sysv.shmall=1024
</programlisting>
        Note that in some macOS versions,
        <emphasis>all five</emphasis> shared-memory parameters must be set in
        <filename>/etc/sysctl.conf</filename>, else the values will be ignored.
       </para>

       <para>
        <varname>SHMMAX</varname> can only be set to a multiple of 4096.
       </para>

       <para>
        <varname>SHMALL</varname> is measured in 4 kB pages on this platform.
       </para>

       <para>
        It is possible to change all but <varname>SHMMNI</varname> on the fly, using
        <application>sysctl</application>.  But it's still best to set up your preferred
        values via <filename>/etc/sysctl.conf</filename>, so that the values will be
        kept across reboots.
       </para>

      </listitem>
     </varlistentry>

     <varlistentry>
      <term><systemitem class="osname">Solaris</systemitem></term>
      <term><systemitem class="osname">illumos</systemitem></term>
      <listitem>
       <para>
        The default shared memory and semaphore settings are usually good enough for most
        <productname>PostgreSQL</productname> applications.  Solaris defaults
        to a <varname>SHMMAX</varname> of one-quarter of system <acronym>RAM</acronym>.
        To further adjust this setting, use a project setting associated
        with the <literal>postgres</literal> user.  For example, run the
        following as <literal>root</literal>:

Title: IPC Configuration for Various Operating Systems
Summary
This section provides platform-specific guidance on configuring IPC parameters, including shared memory and semaphore settings, for PostgreSQL on various operating systems, including OpenBSD, Linux, macOS, and Solaris, with instructions on using sysctl, modifying configuration files, and setting project settings to ensure optimal performance and compatibility.