---
title: "Operations · Agent Wranglers"
url: https://agentwranglers.se/playbook/data/operations
updated: 2026-10-20
licence: "All rights reserved"
---

# Operations

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Keep the database healthy day to day. Pool connections, set time limits, watch slow queries and growth, and let routine maintenance run.

**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`.

## Required

- [Set time limits on every query](https://agentwranglers.se/playbook/data/operations/query-timeouts): Give every query and transaction a time limit, so one slow query cannot hold locks and connections forever.
- [Watch slow queries](https://agentwranglers.se/playbook/data/operations/slow-query-log): Record queries that take longer than a set time, and fix or explain the five worst every week.
- [Let routine maintenance run](https://agentwranglers.se/playbook/data/operations/maintenance): Keep 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](https://agentwranglers.se/playbook/data/operations/app-database-role): Connect 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](https://agentwranglers.se/playbook/data/operations/connection-pooling): Reuse a small, fixed pool of connections instead of opening one per request.
- [Watch size and growth](https://agentwranglers.se/playbook/data/operations/capacity): Track how fast the database and its biggest tables grow, and alert well before disk or plan limits are reached.

- Previous: [Personal data](https://agentwranglers.se/playbook/data/personal-data)
- Next: [Caches and copies](https://agentwranglers.se/playbook/data/caches-and-copies)
- [All chapters](https://agentwranglers.se/playbook/data)
