-
Notifications
You must be signed in to change notification settings - Fork 185
Add documentation for long-lived Postgres pools #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8858328 to
071e7fd
Compare
|
I didn't know about |
|
Our workload involves a high number of queries that complete quickly and we have a short Even after making this change we are still seeing a leak, though it's slower now. I'll keep looking into this. Do you have idea why CI is failing? From the other examples in the README, I would've assumed |
|
The remaining apparent memory leak was solved with aws/amazon-ecs-agent#3594 (comment) After confirming the memory usage was stable, I then disabled the
|
2f4d3ba to
b1cf396
Compare
|
Is there any intention to merge this at some point? |
|
I'm hesitant to merge this as it is pointing fingers at Do you use the statement cache a lot? I mean A simple The statement cache currently has no way of removing statements automatically so you should never use it for dynamically generated queries. See: |
|
I see. And I generally agree. I am still working on a way to reproduce the issue. But I can say that I never make any use of I am currently working with my What I can say so far: if my So I think there might some interaction between different statements (SELECT and INSERT),... |
|
Ok, I will stop for now. I have found out that as long as no other DB operation takes place on any of the pool's connections, the large 'INSERT' statements I run do not lead to any memory issue / overhead. |
|
@seanlinsley @inzanez Did you find the source for the leaking memory by now? |
|
Per rust-postgres/rust-postgres#1081, the memory leaks I observed were from |
7a9da3d to
f713c85
Compare

At pganalyze we run a long-lived Postgres pool, and with the help of bytehound have discovered that a certain query with large bind params appears to leak memory. While it may be possible to fix this leak, there may be leaks elsewhere or future changes may introduce them, so it's probably best for deadpool to recommend that users with long-lived pools call
retainto prune old database connections.I've both added an example to the README that's similar to our configuration, and updated the
retainfunction docs to highlight this issue.