Connection-per-request workloads
Serverless functions frequently opening short-lived database connections.
Neon · Const
Neon’s pooled endpoint uses port 5432, the default PostgreSQL port. Choose it with a hostname ending in -pooler; the endpoint uses PgBouncer in transaction mode for high-concurrency workloads.
A Neon pooled endpoint uses the same PostgreSQL port as a direct endpoint: 5432. Pooling is selected by using a hostname whose endpoint ID ends with -pooler; PgBouncer then manages client connections in transaction mode.
postgresql://<user>:<password>@<endpoint-id>-pooler.<region>.aws.neon.tech/<dbname>?sslmode=requireconst url = new URL(process.env.DATABASE_URL);
console.log(url.port || "5432");
console.log(url.hostname.endsWith("-pooler."));Reads a Neon connection URL and checks its port and pooled-hostname convention.
Serverless functions frequently opening short-lived database connections.
Applications needing many simultaneous client connections.
Services where pooling is selected in Neon’s Connect modal.
The pooled endpoint uses port 5432, Neon’s default PostgreSQL port. Pooling is indicated by adding -pooler to the endpoint ID in the hostname.
Follow-up: How would you enable pooling? Use the pooled connection string from the Connect modal, or add -pooler to the endpoint ID in a valid connection string.
Use the pooled connection string for serverless functions and connection-per-request workloads. It routes clients through PgBouncer and supports up to 10,000 concurrent connections.
Follow-up: When should it be avoided? Prefer a direct connection for migrations, logical replication, or other persistent/session-sensitive operations.
The pooled endpoint is identified by the -pooler suffix in the hostname, while the direct endpoint has no such suffix. Both use Neon’s default PostgreSQL port, 5432.
Follow-up: What is the operational difference? The pooled endpoint uses PgBouncer in transaction mode; the direct endpoint connects without that pooler layer.
Connection poolerDirect connectionPgBouncerConnection poolingConnect to your branch