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

Should I keep using Pool rather than Client with RDS Proxy

Open oriarazi opened this issue 1 year ago • 1 comments

Hello, I have a question about the best practice when connecting RDS Proxy. (TL;DR Should I use Pg.Pool or Pg.Client ?)

Let's say I am querying the database multiple times, sometimes concurrently(multiply SELECT statements).

I know RDS Proxy has its pooling, but does it mean we do not need pooling to the Proxy itself at the application level?

Thanks!

oriarazi avatar Aug 13 '24 12:08 oriarazi

i think you should use Pg.pool becuase Pg.client is use for single transaction. let suppose you are managing a bank transaction so in that case you have to use Pg.client because you have to mutate two data without failing mean (if one SELECT statement fail then both SELECT statement should fail). if amount is deduct from a user then it have to add in another user. but if you concern about making SELECT statements mulitple time and your target is that even if a SELECT statement doesn't get executed then it doesn't effect other SELECT statement.

corazoan avatar Oct 14 '24 05:10 corazoan