日本語

Hosted PostgreSQL and MySQL

Supabase, PlanetScale, Cloud SQL, AlloyDB, RDS, and Aurora each take a connection string in DATABASE_URL, and differ in their ports, poolers, and TLS settings.

The settings each service asks for

Supabase, PlanetScale, Cloud SQL, AlloyDB, RDS, and Aurora run PostgreSQL or MySQL, so examples/postgres connects to any of them once DATABASE_URL holds the service's connection string. They differ in the settings the table lists, as their documentation gave them in October 2026. sqlx built with its tls-rustls feature checks a server's certificate against the Mozilla list of root certificates, and reads sslrootcert as the path of a certificate file.

ServiceConnectionTLSNote
Supabase (PostgreSQL)postgresql://postgres:PASSWORD@db.REF.supabase.co:5432/postgres, over IPv6 unless the project has the IPv4 add-on. The session pooler takes user postgres.REF on port 5432Off by default. sslmode=verify-full with sslrootcert naming the CA file from the database settingsThe transaction pooler on port 6543 does not support prepared statements, and sqlx prepares every query by default, so use the direct connection or the session pooler
PlanetScale (PostgreSQL)Port 5432 reaches PostgreSQL, and 6432 reaches PgBouncer in transaction modeRequired: sslmode=verify-fullPlanetScale's own string adds sslrootcert=system, a word sqlx would read as a file name, so leave it out
PlanetScale (Vitess, MySQL)A mysql:// URL with sqlx's mysql featureClients without full TLS support do not connectForeign keys are a setting of the database, and work only while it is unsharded
Cloud SQL, AlloyDB (from Cloud Run)The Unix socket under /cloudsql/INSTANCE_CONNECTION_NAME, as postgres://USER:PASSWORD@/DB?host=/cloudsql/INSTANCE_CONNECTION_NAME. sqlx adds the .s.PGSQL.5432 that PostgreSQL's socket name ends inThe socket is encrypted without a settingAdd the instance to the Cloud Run service's Cloud SQL connections
RDS, AuroraA password, or an IAM token from aws-sdk-rds's auth_token::AuthTokenGeneratorsslmode=verify-full with the AWS CA fileA token lasts 15 minutes, so each new connection of the pool needs a fresh one

Pools on Vercel

Vercel runs one process per instance of a function and adds instances as requests grow, and each process opens its own pool, so the connections to the database multiply with the instances. Keep max_connections small there, and connect through the service's pooler where it has one that supports prepared statements. Vercel's own helper for this, attachDatabasePool, is a Node.js API.

Next