Pool.query vs pool.connect.. node-postgres

Pool.query vs pool.connect.. node-postgres
0
#1

Hi friends…

I’m sorta new to node and node-postgres (to all things programming if i’m being entirely honest) and I noticed you can use pool.query and pool.connect(which returns a promise of a client) when using a connection pool. I would like to know how pool.query works as opposed to Client.query from a single client and Client.query from a pool of connected clients. Also feel free to shed more light on how connection pooling and querying works as there is not enough documentation for beginners on this topic.
Thanks

0 Likes

#2

I can only give you a hint on the Postgresql part:

First. How many simultaneous sessions? How many databases? How long sessions?

— 1-100 open sessions per database does not need any pooling. Postgresql will manage this well.
— 100+ open sessions may OR may not need pooling.

If you give more more info, it is easier to give you better answer.

0 Likes