Databases
Fix “too many connections” errors
The database refuses connections under light traffic on a serverless host.
- What you get
- One shared connection setup that goes through a pooler, sized for your plan.
- Paste it into
- Your AI tool, in your project
The prompt
My app sometimes fails with "too many connections" or connection timeouts, even with little traffic. Find every place the code creates a database client or connection. Tell me whether a new one is made per request or per function instance, and whether the connection string goes straight to the database or through a pooler. Check the connection limit on my database plan and how my host runs the code. Serverless functions open many short-lived connections. Fix it so the app reuses one client per instance and connects through the pooler in production, with a sensible pool size. Show me which environment variable changes and how to confirm the connection count afterwards.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in.
More in Databases
Rename or remove a column without losing data
A simple rename can break the live app or wipe a column for good.
Let the database reject bad data
Duplicates, empty fields and orphaned rows creep in because only the form checks them.
Delete a user and everything they own
Someone asks you to delete their account, and their data is scattered across tables and services.
Fill your local app with realistic test data
Your local database is empty, so you test against production or three rows named “test”.