Skip navigation
What it takes to make a Postgres connection pooler invisible to your app.
0:00 / 14:15

What it takes to make a Postgres connection pooler invisible to your app.

Supabase

218K followers

Visit on X
119 likesDownloadOriginal post

10,210 views

What it takes to make a Postgres connection pooler invisible to your app. Manan Gupta, a Multigres engineer at Supabase, goes inside the Multigres pooler: tracking session settings (including Postgres's unusual DateStyle), sharing prepared statements across clients and recovering when a schema change makes them stale, scaling LISTEN/NOTIFY through one shared connection, and matching Postgres when you commit a failed transaction.

12 Comments

Comments from the original post on X (Twitter)

  • Marc Höffl's profile picture

    @marchoeffl

    curious how you recover prepared statements after a schema change without forcing a reconnect

    3 likes

  • Jangra's profile picture

    @jxngrx

    does the pooler actually invalidate stale prepared statements gracefully, or is there a window where clients using old ones just break? that's the edge case i'd test first.

    1 like

  • Jonathan Tsen's profile picture

    @TsenJonathan

    handling DateStyle so someone's app doesn't randomly flip day and month midway through the night is heroic work

    1 like

  • RYDA⚒️🧙🏾‍♂️🛸's profile picture

    @Rxdha1

    Supa chad

    1 like

  • Elias's profile picture

    @isbkch

    prepared statements across transaction pooling is always where apps silently break

    1 like

  • Arjun's profile picture

    @consoledotlog

    of course DateStyle is the weird one

  • Lucas Sacheto's profile picture

    @0xSacheto

    pooler issues are the sneakiest because they always look like app bugs first. love these deep dives

  • Ahsan Sheikh's profile picture

    @itsAhsanSheikh

    Prepared statements are the classic break with transaction pooling: a client prepares on one backend, its next transaction lands on another, and it gets "prepared statement does not exist". Does Multigres re-prepare per backend, or share a cache keyed by query text?

  • BreezeOg's profile picture

    @BreezeOg1

    datestyle always the weird one hehe

  • Musawir Raji 🪁's profile picture

    @MusawirRaji

    does the pooler keep settings that row level security policies read, like a company id set per session, from carrying over to the next client? on the platform I'm building the company always comes from the session, so that's the one I would test first

  • Dima's profile picture

    @skromez

    does Multigres handle direct TLS with libpq 17 ALPN out of the box? hit a weird snag with that putting PgBouncer behind Traefik recently

  • Yaser Abbass's profile picture

    @yaserabbass

    the DateStyle bit is the kind of thing you only find at 2am