Search code examples
postgresqlamazon-web-servicesamazon-rds

Why cannot I have more than 10 concurrent connections to a Postgres RDS database


After 10 connections to a Postgres RDS database I start getting error - Too Many Connections or Timed-out waiting to acquire database connection.

But when I check max_connections it shows 405. pg_roles shows -1 as rollconnlimit. If none of the ceilings are hit why can I not have more than 10 concurrent connections for that user?


Solution

  • A comment from @jjanes on another question gave me a pointer.. the bottleneck was datconnlimit setting from pg_database. Changing it using query below fixed the issue:-

    ALTER DATABASE mydb with CONNECTION LIMIT 50