Database / Supabase Intermediate to Advanced Interview Questions
How does Supabase's connection string differ between the direct connection, session pooler, and transaction pooler?
All three ultimately reach the same Postgres database, but they differ in what sits between the client and Postgres, and in what connection-level features survive that path.
| Direct Connection | Session Pooler | Transaction Pooler |
| One dedicated Postgres connection per client | Pooled, held for the client's whole session | Pooled, checked out per transaction only |
| Supports prepared statements, LISTEN/NOTIFY | Supports most session-level features | Cannot reliably support prepared statements |
| Best for long-lived backend servers | Good general-purpose default | Best for serverless/Edge Functions with many short-lived connections |
The direct connection is a real, dedicated Postgres backend process, so it supports every session-level Postgres feature but doesn't scale to thousands of concurrent short-lived clients. The transaction pooler trades some of those features away specifically to support very high connection concurrency cheaply, which is exactly the trade a serverless or Edge Function workload wants to make.
More Related questions...