feat: let pool.query pipeline on a connection that is already working - #3739
Open
nigrosimone wants to merge 6 commits into
Open
feat: let pool.query pipeline on a connection that is already working#3739nigrosimone wants to merge 6 commits into
nigrosimone wants to merge 6 commits into
Conversation
…te in pipeline mode
nigrosimone
marked this pull request as ready for review
August 10, 2026 06:12
Contributor
Author
|
A good point from @charmander #3738 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #3738
Passing
pipeline: trueto aPooltoday changes nothing forpool.query(): every query checks out a connection for itself, so there is never a second query to pipeline behind it.With this change
pool.query()can send a query on a connection that is still waiting for results. The pool opens connection up tomaxfirst, then picks the one with the fewest queries in flight, capped by a newmaxPipelineoption (default 10) and by socket backpressure.maxkeeps its meaning of number of connections.pool.connect()still checks out a connection nobody else is using, so transactions are not affected. Off by default.A connection with queries in flight is not idle: idle timeout,
maxUses,maxLifetimeSecondsandpool.end()wait for the pending results before closing it.usage:
Disclaimer: made with the help of Opus 5 and a final check with Fable 5. I have done my best to verify that everything is correct and not AI slopped! tested on my side (patching node modules), seem works