Operations
Keep the database healthy day to day. Pool connections, set time limits, watch slow queries and growth, and let routine maintenance run.
- Required 4
- Recommended 2
Required
Set time limits on every query
RequiredGive every query and transaction a time limit, so one slow query cannot hold locks and connections forever.
Watch slow queries
RequiredRecord queries that take longer than a set time, and fix or explain the five worst every week.
Let routine maintenance run
RequiredKeep the database's own maintenance running, so tables don't bloat and the planner has fresh statistics.
Give the app a least-privilege database user
RequiredConnect the app with a user that can read and write its tables, but cannot change the schema or read other databases.
Recommended
Pool database connections
RecommendedReuse a small, fixed pool of connections instead of opening one per request.
Watch size and growth
RecommendedTrack how fast the database and its biggest tables grow, and alert well before disk or plan limits are reached.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers data playbook: https://agentwranglers.se/playbook/data/operations.