-
Notifications
You must be signed in to change notification settings - Fork 842
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
README should clearly state some gotchas #750
Conversation
There is no requirement or even suggestion that people should use PgBouncer. They should use pgxpool or connect with database/sql which has its own built-in pool. PgBouncer only becomes relevant when you have multiple application servers. I've added a getting started guide to the wiki and link to that from the readme -- hopefully that clarifies some things. |
what about lines 32 and 33 |
That addition would be fine, though it should link to https://pkg.go.dev/ instead of the old Go doc. The old Go doc doesn't support modules so would be for |
I think simply linking to the wiki would be helpful, I found it hard to find about pgxpool or the need for it. This section of the wiki is very helpful: https://github.com/jackc/pgx/wiki/Getting-started-with-pgx#using-a-connection-pool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is helpful to the people who are using pgBouncer like me. This should be somewhere in the document, or just a link for the people who are using pgBouncer. For me with pgBouncer, pgxpool was failing silently with less number of rows returned (2 out of 250).
// The format for "DATABASE_URL" is here: | ||
// https://godoc.org/github.com/jackc/pgconn#ParseConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been searching the wiki and README looking for this documentation. Much thanks! I was a confused because the only examples I could find were not using the standard URL format even though the variable was called DATABASE_URL
.
@Zamiell would you mind editing the PR to apply the changes required by Jack and fix the conflicts so we can merge it? Thanks! |
it's a simple readme update, feel free to edit what i have to your liking |
Even with pgxpool? I assume this is because, unlike most drivers, If so, being able to internally buffer and materialize small result-sets would help a lot for this, like It can be done heuristically too - during post- Though one possible downside of doing it heuristically is that apps could see behaviour changes as result-sets get bigger, where some workload that previously immediately released the connection instead holds it over some expensive and slow operation it does when iterating over each result row. Explicit might be better, perhaps with a ... but it looks like |
@Zamiell It's not as simple as just saying "use pgbouncer" IMO. There should be no need to if the app treats the window between There are many downsides to using a pgbouncer proxy (or putting it as a reverse proxy in front of your app); it's not a lot of help in session-pooling mode. But in transaction-pooling mode many postgres features are unusable or difficult to use, such as session-level Doesn't pgxpool address most of this anyway? Apps should still minimise the time they hold a particular connection busy, of course, but internal pooling should improve things significantly for apps that require it. |
Experience with large production apps has made me conclude that pgbouncer is rarely the answer. It requires very careful planning, and the tradeoffs often surprise people new to it. I would certainly not recommend it for most users (or indeed at all). pgxpool is the correct answer to the question "How can I use pgx in a multithreaded app?". |
closing this since the maintainers don't seem to be interested |
Thanks for trying to contribute @Zamiell . I'm not a maintainer of this project btw. It's almost always helpful to suggest docs changes etc; even when it doesn't land up being something agreed on, it can highlight an issue or help others find an answer. In this case I think pgxpool is probably a suitable answer for most applications, especially when combined with limiting how long result-sets are held open. Suggesting pgbouncer is useful but has too many gotchas to make sense to recommend for the general case. |
feel free to edit what I've done, obviously