title: how to determine max_client_conn for pgbouncer
body: <p>I'm sort of an "accidental dba" so apologies for a real noob question here. I'm using pgbouncer in <strong>pool_mode = transaction</strong> mode. Yesterday I started getting errors in my php log:</p>
  
  <blockquote>
    <p>no more connections allowed (max_client_conn)</p>
  </blockquote>
  
  <p>I had <strong>max_client_conn</strong> = 150 to match <strong>max_connections</strong> in my postgresql.conf.</p>
  
  <p>So my first question is, should pgbouncer max_client_conn be set equal to postgresql max_connections, or am I totally misunderstanding that relationship?</p>
  
  <p>I have 20 databases on a single postgres instance behind pgbouncer with the default default_pool_size = 20. So should max_client_conn be 400? (pool_size * number_of_databases)?</p>
  
  <p>Thanks</p>