Skip to content
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

Separate DATABASE_URLs for replication and query connections. #1885

Open
thruflo opened this issue Oct 23, 2024 · 1 comment
Open

Separate DATABASE_URLs for replication and query connections. #1885

thruflo opened this issue Oct 23, 2024 · 1 comment

Comments

@thruflo
Copy link
Contributor

thruflo commented Oct 23, 2024

I've been doing a pass on deployment docs, including verifying the steps to connect to managed Postgres providers. In a few cases (Supabase, GCP, etc.) they provide a direct IP address for logical replication and a connection-pooled IP address for interactive access.

We currently accept a single DATABASE_URL. Because this is used for logical replication, it must be the direct IP address. Which works but is inefficient. Because we only need to special case the logical replication connection. Our interactive queries could perfectly well go through the user's normal DB pooler, reducing our impact on their database.

I propose that we adjust our config to support a single DATABASE_URL as the current default but also support providing a pair of REPLICATION_DATABASE_URL and INTERACTIVE_DATABASE_URL or whatever the best naming is.

Plus we would need to extend this pattern for multi-tenancy, so that apps can be configured with a pair of values, instead of one URL per database ID.

@balegas
Copy link
Contributor

balegas commented Oct 23, 2024

That sounds good and potentially can help with initial sync latency, since we're making multiple requests on a non-pooled connection on the other side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants