connect / release on high frequency endpoints
dbauszus-glx opened this issue · 1 comments
dbauszus-glx commented
I am writing a web mapping framework which uses fastify-postgres in many of the data endpoints. Certain endpoints are hit very frequently (hundreds of times from a single user).
Would you recommend to connect, query and release?
Or would you recommend to connect and store the connection in a global and then just query, query, query.
Both methods are working fine for me but I am concerned the connect handshake is taking time while with the always connected solution I am worried what happens if a connection errs.
mcollina commented
Fastify-postgres initialize a connection pool, calling connect()
is fine.