-
Notifications
You must be signed in to change notification settings - Fork 268
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
Connecting through pgbouncer raises duplicate_prepared_statement error #297
Comments
PgBouncer requires setting the "unnamed" prepare mode. Do you see this despite the setting? https://github.com/elixir-ecto/postgrex#pgbouncer
|
That's perfect. I was trying to search for an answer to this problem by searching for something from the error message rather than searching for pgbouner. Should have read the whole README before posting 😬 Thanks for the quick answer. I was able to get connections opened now 👍 💛 💙 💚 ❤️ |
@michalmuskala I assume there is a downside to this? This postgresq docs say:
|
Unnamed prepared statements are a feature of the wire protocol and not available through regular SQL. My understanding is that the downside is that they imply two round-trips for each query - one to prepare and one to execute. |
I'm experimenting with elixir in an existing production system and want to connect to my postgres server through a pgbouncer instance to reduce the total number of connections to the actual database.
When I try to start my application I get the following error:
I think this is because postgrex is trying to create a prepared statement in the context of each connection, but the connection is actually being shared at the pgbouncer level. Has anyone tried to do this before? Is there a configuration option for disabling those prepared statements or a way to check if they exist before creating them?
The text was updated successfully, but these errors were encountered: