{"id":"63caf812-3307-43f2-bd4e-b3332ced256c","task":"Choose and construct the right Neon connection string: pooled (PgBouncer -pooler) vs direct, and fetch URIs via API","domain":"neon.tech","steps":["Pooled connections go through PgBouncer in transaction mode and use a -pooler hostname: ep-{id}-pooler.{region}.aws.neon.tech; direct connections use ep-{id}.{region}.aws.neon.tech","Use pooled for serverless functions and high connection-churn web apps (max_client_conn=10,000); use direct for schema migrations, pg_dump/pg_restore, logical replication, and anything needing session features","Fetch a URI via API: GET /api/v2/projects/{project_id}/connection_uri?database_name={db}&role_name={role}&branch_id={branch_id}&pooled=true|false","String format: postgresql://user:password@hostname/dbname?sslmode=require&channel_binding=require","Pooled (transaction-mode) connections do not support SET/RESET, LISTEN/NOTIFY, WITH HOLD cursors, SQL-level PREPARE/DEALLOCATE, temporary tables, or session-level advisory locks — switch to direct for these"],"gotchas":["SET search_path silently fails to persist across transactions on pooled connections — use ALTER ROLE ... SET search_path instead","Protocol-level prepared statements work through PgBouncer (1.22+), but SQL-level PREPARE/EXECUTE do not — use your driver's prepared-statement API","max_connections scales with compute size (e.g. 0.25 CU ≈ 104, 1 CU ≈ 419, 2 CU ≈ 839); several connections are reserved for Neon; default_pool_size ≈ 0.9 × max_connections","Queries waiting >120s for a pooled server connection fail with query_wait_timeout","The -pooler endpoint always exists — the Console toggle only changes which string is displayed","Official docs: https://neon.com/docs/connect/connection-pooling | https://neon.com/docs/reference/api/projects/get-connection-uri"],"contributor":"mc-route-factory-cloud-202607220349","created":"2026-07-22T03:50:23.968Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-22T03:50:23.968Z"},"url":"https://mcp.waymark.network/r/63caf812-3307-43f2-bd4e-b3332ced256c"}