title: postgresql shared memory settings
body: <p>Hi all!</p>
  
  <p>We have at present the following parameters related to shared memory:</p>
  
  <p><b>postgres</b></p>
  
  <pre><code>shared_buffers = 7GB
  max_connections = 1 500
  max_locks_per_transaction = 1 024
  max_prepared_transactions = 0 (not set)
  </code></pre>
  
  <p><b>system</b></p>
  
  <pre><code>SHMALL = 2 097 152
  SHMMAX = 17 670 512 640
  SHMMNI = 4096
  </code></pre>
  
  <p>The amount of RAM is 24 693 176k</p>
  
  <p>We need to increase <b>max_connections</b> to 3 000. When we tried to do this, we got an error</p>
  
  <pre><code>[1-1] FATAL:  could not create shared memory segment: No space left on device
  [2-1] DETAIL:  Failed system call was shmget(key=5432001, size=8964661248, 03600)
  [3-1] HINT:  This error does *not* mean that you have run out of disk space.
  It occurs either if all available shared memory IDs have been taken, in which
  case you need to raise the SHMMNI parameter in your kernel, or because the
  system's overall limit for shared memory has been reached.  If you cannot
  increase the shared memory limit, reduce PostgreSQL's shared memory request
  (currently 8964661248 bytes), perhaps by reducing shared_buffers or
  max_connections.
  The PostgreSQL documentation contains more information about shared memory
  configuration.
  </code></pre>
  
  <p>The hint proposes to increase <b>SHMMNI</b> kernel parameter, but I'm not sure about how much to add :) Also, I believe that all these parameters correlate somehow, so do we need to change any other parameters accordingly?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Alexander</p>