Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBetter documentation for connection pooling #5
Comments
|
Thanks a lot ! And thank you for the issue, that'll be good to have in the documentation. As a starter for the docs I'll answer your questions and describe it here Yes, connections are handled on failed queries so it shouldn't be a user concern except maybe deciding on the seconds of The connection pool is implicit and lazy. The only thing defining it is the Connections are created lazily once a query is created. This means that simply doing That means that any query which was already sent over the wire will be rejected if the connection is lost. It'll automatically defer to the error handling you have in your app, and since connections are lazy it'll automatically try to reconnect the next time a query is made. The benefit is no weird generic "onerror" handler that tries to get things back to normal, and also simpler application code since you don't have to handle code paths out of context. There are no guarantees about queries executing in order unless using a transaction with I have timeout for queries on my todo as well as cancelable queries. The usage will most likely look like this: timeout
cancellable
I'm also working on multihost support which will work like specified for libpq here: https://www.postgresql.org/docs/10/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS Also related — I hope that covered most of your questions :) |
First of all - thank you very much for this great piece of work! This is by far the best approach to a postgres client.
Can we have a bit more information about connection pooling please?
As far as I can see there is no need for releasing a connection, even in case of a failed query? Does postgres handle all those cases?
What happens if the pool is full? Are queries queued and executed in a fifo manner?
Is there a timeout for queries?
What happens if a db becomes unavailable (temporarily or permanently), or if the master node changes in a high availability setup? Does it try to reconnect and to continue executing the queue?