Difference between pg and pg-pool module in NodeJs?

1.4k views Asked by At

I am working on NodeJs project which involves connection with PostgreSQL database. I came across two packages, namely, pg and pg-pool. Creator of these two packages is same, so there must be some differences in the functionalities of these two packages. Any idea, what are those? Which of the packages should be preferred?

1

There are 1 answers

0
vitaly-t On BEST ANSWER

It is possible to write an app by using the Pool object only, but it still must be included via the main pg driver:

const Pool = require('pg').Pool;

pg-pool only implements the pool itself + the querying interface. There is a lot more to the overall library - all resides in the pg module.

And you only include the pg within your package.json.