node-postgres: Setting max connection pool size node-postgres: Setting max connection pool size postgresql postgresql

node-postgres: Setting max connection pool size


defaults are defined in node-postgres/lib/defaults https://github.com/brianc/node-postgres/blob/master/lib/defaults.js

poolSize is set to 10 by default, 0 will disable any pooling.

var pg = require('pg');pg.defaults.poolSize = 20;

Note that the pool is only used when using the connect method, and not when initiating an instance of Client directly.


node.js is single threaded why want to have more then 1 connection to db per process ? Even when you will cluster node.js processes you should have 1 connection per process max. Else you are doing something wrong.