app.get('/report', async (req, res) => {
const client = await pool.connect();
const { rows } = await client.query('SELECT * FROM report');
res.json(rows);
});
The client is never released, so all ten connections stay checked out and
pool.connect() waits indefinitely for a free one"The client is never released" is correct. A client from pool.connect() must be returned with client.release(). Put the release in a finally block, so an error does not leak the client. Once all ten clients are checked out, new callers wait in the pool's queue forever.
"PostgreSQL's default max_connections is 10" is wrong: the default is 100. Also note that for a single statement, pool.query() checks out a client and releases it for you.
Read more