Databases Best Practices
Migrations in CI; never manual prod DDL. Use this checklist for Postgres, Prisma, Drizzle, and MongoDB on Node.js teams.
Search across all documentation pages
Migrations in CI; never manual prod DDL. Use this checklist for Postgres, Prisma, Drizzle, and MongoDB on Node.js teams.
migrate deploy successALTER in prod consoles.CONCURRENTLY on Postgres when needed.pool.max sized with replica count formula - stays under 70% of max_connections.pool.end() / $disconnect() on SIGTERM in graceful shutdown.SELECT 1 not just TCP socket open.$1 for pg, ORM APIs for Prisma/Drizzle.SELECT * list endpoints - pagination and column selection required.majority for critical data.Only in declared incident with post-incident migration file backfill. Default answer is no.
Either - one tool per service. Command is migrate deploy equivalent in release job.
Start 10 for pg. Recalculate when replica count or worker fleet changes.
Yes - separate pool or routing in repository for SELECT-heavy paths.
Service owner fixes app queries; DBA/platform reviews indexes and Postgres parameters.
Rare for multi-instance APIs. Acceptable for edge/single-tenant tools with backup strategy.
Team choice - either is fine with repository boundary and migration discipline.
Yes - pool exhaustion appears only under concurrent load. See Load Testing.
Connection storm after scale-up without pooler. Fix pooler before raising max_connections.
Start with Databases Basics and local Docker Postgres.
pg) - driver patternsStack versions: This page was written for Node.js 24.18.0 (Active LTS), npm 10+, TypeScript 5.6+, Express 5, Fastify 5, and NestJS 11.
Reviewed by Chris St. John·Last updated Jul 16, 2026