node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

Do I get any problems when using multiple pg libaries/connection ?

Open pullmann4rent opened this issue 1 year ago • 0 comments

Hello,

When I use the pg libary and I use 10 database connection with pool, do I get any problems or what is the disadvantage ?

exp:

  const db1 = new Pool({
    host: 'xxx',
    user: 'postgres',
    database: 'xxx',
    password: 'xxx',
    ssl: { rejectUnauthorized: false },
    port: 54232,
    max: 20,
    idleTimeoutMillis: 30000,
    connectionTimeoutMillis: 10000,
  });

  const db2 = new Pool({
    host: 'xxx',
    user: 'postgres',
    database: 'xxx',
    password: 'xxx',
    ssl: { rejectUnauthorized: false },
    port: 54232,
    max: 20,
    idleTimeoutMillis: 30000,
    connectionTimeoutMillis: 10000,
  });

  const db3 = new Pool({
    host: 'xxx',
    user: 'postgres',
    database: 'xxx',
    password: 'xxx',
    ssl: { rejectUnauthorized: false },
    port: 54232,
    max: 20,
    idleTimeoutMillis: 30000,
    connectionTimeoutMillis: 10000,
  });
  const db4 = new Pool({
    host: 'xxx',
    user: 'postgres',
    database: 'xxx',
    password: 'xxx',
    ssl: { rejectUnauthorized: false },
    port: 54232,
    max: 20,
    idleTimeoutMillis: 30000,
    connectionTimeoutMillis: 10000,
  });
...

BTW: All databases are different and not the same so all are seperated

pullmann4rent avatar Jan 17 '24 01:01 pullmann4rent