How the pieces connect
@vercel/postgres ships two entry points. The sql export reads POSTGRES_URL from the environment and talks to the pooled endpoint (PgBouncer in transaction mode) — that is what you import in Server Components and Route Handlers. The createClient/createPool helpers exist when you need an explicit client or to pass a different connection string. On Vercel, vercel env pull or the dashboard integration injects POSTGRES_URL (pooled), POSTGRES_URL_NON_POOLING (direct), and POSTGRES_PRISMA_URL automatically.
Data flow: a Server Component runs on the server, calls sql, the query goes through the pooler to Postgres, and the rendered HTML streams back. Nothing reaches the client. Because each serverless invocation is short-lived, the pooler — not your function — owns the long-lived TCP connections to the database.