Comments (11)
+1 for this since pgbouncer has a solution and since supabase forces you to use supavisor now it seems to be worth wild to add
from supavisor.
PgBouncer actually just merged support for this: pgbouncer/pgbouncer#845 (Not released yet, but in main branch)
from supavisor.
What if two different clients linked to one pg connection make two different prepared statements with the same name?
To clarify this case: We generally want both clients to use the same prepared statement. A classic "one process per request" infrastructure often means thousands of client connections and hundreds of server connections. Let's assume 10:1. If each of those processes handles 100 requests before getting cycled, then a given query used once in each request would use 5 custom plans and 95 generic plans for a 95% cache hit rate. If that prepared_statement is available to all clients using that server connection then we'd instead see a 99.5% hit rate.
from supavisor.
For sure. I think it really depends on how the client handles things though. Do they recreate the prepared statement on a connection if it doesn't exist? How do they name them?
I'm thinking a separate pool mode which pins client connections to database connections would be good. So transaction
mode behaves exactly like PgBouncer transaction
mode and you could use this other mode if it's suitable for your workload and provides perf improvements.
from supavisor.
For reference: a PR for pgbouncer that claims to make things work: pgbouncer/pgbouncer#757 (comment)
from supavisor.
Very helpful! Thank you!
from supavisor.
from supavisor.
I personally think this would be an important issue to fix due to some client libraries rely on this to work properly, such as Rust's SQLx, at the moment it seems like only pgcat supports it.
from supavisor.
PgBouncer actually just merged support for this: pgbouncer/pgbouncer#845 (Not released yet, but in main branch)
Would this be released on existing Supabase's cloud hosted databases? I would really like to use it with my Supabase database, it is currently using supavisor as its connection pool.
from supavisor.
Done, and deployed to production!!
from supavisor.
I feel like this issue should probably be re-opened given that this doesn't add support for protocol level named prepared statements (which are the ones that basically all client libraries use). Related issue and my comment there can be found here: #239 (comment)
from supavisor.
Related Issues (20)
- Isolate tenant's database HOT 1
- Hosted Supavisor closes connection executing query with large result set HOT 1
- Queries on tables that use CITEXT are 4x slower when using Supavisor vs a direct connection to the db HOT 5
- set up a soft upgrade
- Better error when there is no `.` in the username or tenant `reference` in the `options` params HOT 4
- ClientHandler maximum heap size reached with pg_dump HOT 2
- Deploy supavisor for multiple databases HOT 1
- Custom pool implementation with telemetry
- Maybe switch to local pool DbHandler strategy
- Supabase IP Ban Issue with Connection Pooling HOT 6
- Failed to connect using interval private network Postgres
- Revalidate user secrets if Supavisor isn't allowed to connect to the tenant's database
- Supavisor brings down infrastructure after role modification HOT 4
- Handle `Receive query error`
- Extend Helpers.parse_secret/2 to handle nil or empty secrets
- Specify where to get auth token of user to create first tenant HOT 5
- Docs should mention VAULT_ENC_KEY size needs to be 32 chars HOT 3
- LISTEN / NOTIFY appears to be broken after March 26th
- How to config metrics properly HOT 1
- Create a new Bearer Token HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from supavisor.