Connection pooling
Postgres gives each connection its own process, so a thousand serverless functions each opening a connection will exhaust the server. The Basalt pooler sits in front and multiplexes them.
Transaction mode
A client borrows a server connection for one transaction and gives it back. Prepared statements are not supported in this mode.
import postgres from 'postgres'
const sql = postgres(process.env.DATABASE_URL!, { prepare: false })Session mode
A client keeps its server connection until it disconnects. Use it when a library insists on prepared statements.
Updated
Was this page helpful?