title: PostgreSQL DB performance issues with thousands of connections and distributed transactions
body: <p>We are trying to evaluate PostgreSQL DB as an alternative to Oracle database in our application. We use PostgreSQL 9.5 which is installed on a Linux machine with 128 GBs of memory, 32 CPU cores and SSD storage. Connection pools and distributed transactions are managed by JBoss 7 application server, SQL queries are generated/executed by Hibernate 4. Most tables have tens millions rows, one of them has hundreds millions rows. In total around 3,000 database connections (they are pooled by the application server) are active and used concurrently. We modified some queries, created indexes for slow ones, tuned DB and OS settings based on documentation, etc. However, throughput is few times slower and eventually DB response time increases 10-20 times.</p>
  
  <p>I've done some googling and I couldn't find information about anyone else (ab)using PostgreSQL DB the same way:</p>
  
  <ul>
  <li>using thousands of active database connections</li>
  <li>using this high number of distributed transactions (PREPARED TRANSACTIONS)</li>
  <li>storing billions of rows in one table</li>
  </ul>
  
  <p>Oracle doesn't have any problem handling even higher load. I would appreciate sharing your experience, suggestions, links, etc.</p>
  
  <p>Thanks </p>