You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry it this is more suited for a SO question, but I didn't found this point in the documentation, so perhaps it's also a docs enhancement request 😉 .
We are currently using pg module (not pgp), and we used to struggle with connexion leaks, because in some pieces of code, some forgot to call client.release() 😠
As you can imagine, it's very penalizing because with pg (at least with pg < 6.0), AFAIK pg.connect sends no error when the pool is exhausted (see brianc/node-postgres#1006 (comment)).
So the server is simply blocked and hangs indefinitly.
I'm currently evaluating if we should switch to pgpromise, but, because it's build on top of pg, I wonder if the problem is also present
So with pgpromise :
should we have to releave every connexion ? or are they released automatically after every query ?
what happens if the pool is exhausted ? Is an error sent back ? Or the query is queued until a connexion is available ? Is it possible to set a timeout for that ?
Or in other words : what are the differences with pg on this ?
Thx a lot by advance !
The text was updated successfully, but these errors were encountered:
No. It is all done automatically. There are some very unique cases when method connect is used, to be released when no longer needed, but again, you would barely ever need it.
or are they released automatically after every query?
They are indeed, released automatically.
And when you need to execute more than one query at a time against the same connection, you use either tasks (method task) or transactions (method tx).
what happens if the pool is exhausted ? Is an error sent back ? Or the query is queued until a connexion is available ? Is it possible to set a timeout for that?
It will be waiting till a connection becomes available, no error is thrown. The whole pg-promise architecture is however built around the idea of efficient connection use, so it would never happen, if you design your database layer correctly.
what are the differences with pg on this?
I think the above answers just about cover it 😉 But beside the connections management, the differences are endless, I wouldn't know where to start :) For one thing, it has 10x more powerful query formatting engine, best support for external SQL files, really powerful query generators for complex cases, like multi-row inserts and multi-row updates. etc... too many to list here, you should just read the docs ;)
Have a look at the Wiki pages, and of course at the pg-promise-demo 😉
Hi Vitaly,
Sorry it this is more suited for a SO question, but I didn't found this point in the documentation, so perhaps it's also a docs enhancement request 😉 .
We are currently using pg module (not pgp), and we used to struggle with connexion leaks, because in some pieces of code, some forgot to call client.release() 😠
As you can imagine, it's very penalizing because with pg (at least with pg < 6.0), AFAIK pg.connect sends no error when the pool is exhausted (see brianc/node-postgres#1006 (comment)).
So the server is simply blocked and hangs indefinitly.
I'm currently evaluating if we should switch to pgpromise, but, because it's build on top of pg, I wonder if the problem is also present
So with pgpromise :
Or in other words : what are the differences with pg on this ?
Thx a lot by advance !
The text was updated successfully, but these errors were encountered: