Giter Site home page Giter Site logo

Comments (11)

softwarecurator avatar softwarecurator commented on May 21, 2024 4

+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.

janpio avatar janpio commented on May 21, 2024 2

PgBouncer actually just merged support for this: pgbouncer/pgbouncer#845 (Not released yet, but in main branch)

from supavisor.

hamiltop avatar hamiltop commented on May 21, 2024

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.

chasers avatar chasers commented on May 21, 2024

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.

hamiltop avatar hamiltop commented on May 21, 2024

For reference: a PR for pgbouncer that claims to make things work: pgbouncer/pgbouncer#757 (comment)

from supavisor.

chasers avatar chasers commented on May 21, 2024

Very helpful! Thank you!

from supavisor.

chasers avatar chasers commented on May 21, 2024

Another ref

from supavisor.

marcustut avatar marcustut commented on May 21, 2024

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.

marcustut avatar marcustut commented on May 21, 2024

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.

chasers avatar chasers commented on May 21, 2024

Done, and deployed to production!!

from supavisor.

JelteF avatar JelteF commented on May 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.