-
Notifications
You must be signed in to change notification settings - Fork 229
#4 Primary/replica selection #5
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
Conversation
Worth noting that Postgres and libpq already offer something in this area - the ability to specify multiple hosts in the connection string + Good article: https://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/ About the improvements in PG14: https://www.postgresql.fastware.com/blog/enhancement-to-target-session-attrs |
I think it's similar to this, but maybe not quite the same, because we want clients to be able to select their desired server within the same connection. In many languages, e.g. Ruby, Python, and in large apps, connections are expensive so if we can let the client do a read against a replica and a write against a primary in the same connection, it would be pretty useful. This also paves the way to have almost automatic read-write query routing in the pooler instead of in the app. |
Merge with upstream
Possible implementation for #4
Features
SET SERVER ROLE TO '(primary|replica)'
to route queries explicitly to either the primary or any replica.Bug fixes
ConnectionPool::get
, slightly faster server selection.TODOs