which one effect the connections pool?
Only max_connections is a PostgreSQL configuration parameter. The other one is probably a pooler configuration parameter. The PostgreSQL parameter is about maximum parallel connections. The available connections to not superusers differs by max_connections - superuser_reseserved_connections. Starting with PostgreSQL 16 there's an additional parameter reserved_connections to reserve connections for roles. Each connnection pooler comes with it's own configuration parameters. If you might tell us which one you are using, you probably get more information.
Prisma connection pool What led me to this question is the "too many clients already" error. I checked the max_connections value, and it's at its default of 100, Even after setting Prisma connection limits to 1000 (which is incorrect, just to test). why would the server exceed these numbers? Does every intensive I/O transaction reserve a connection, and does my ORM establish a new connection for each transaction performed at the same time?
Never heard of that pooler, I had to look it up. It is an ORM with client side pooler. In this case you cannot have more database connections as have been configured in PostgreSQL. And keep in mind, that there are reserved connections. By default superuser_reserved_connections is 3, resulting in only 97 connections. And if you have a load balanced application running on several servers it is getting more creepy as you have to divide the 97 connections by the amount of servers.
Does every intensive I/O transaction reserve a connection? and does the ORM establish a new connection for each transaction performed at the same time if the there are no available connection to reuse?
Depends on the ORM. But it should only open as much connections as are configured. A real connection pooler like PgBouncer is queuing requests if there are more requests incoming as there are available connections.
I've just read the part of Prisma where they state to bypass PgBouncer because of prepared statements. I don't know what they are doing in that project, but PgBouncer does support prepared statements.
Обсуждают сегодня