database-optimizer · voltagent/awesome-codex-subagents — Codex subagent: database performance analysis
database-optimizer — a subagent that analyzes database performance. Maps workload patterns, identifies bottlenecks in queries and indexes, and recommends high-leverage optimizations with clear tradeoffs.
MIT ★ 6,505 updated 2026-10-05
.codex/agents/database-optimizer.tomlWhat database-optimizer does
database-optimizer breaks down your database workload: traces hot queries, access paths, and the read-write mix across your boundary. It pinpoints where performance stalls—planner decisions, indexing gaps, join strategies, lock contention, or schema shape—and grounds every claim in actual access evidence.
Each recommendation targets the dominant cost center with explicit tradeoffs: no generic tuning. It validates impact on both normal and stressed workloads, flags lock and transaction risks, and requires a rollback plan for major schema or index changes. The subagent factors in cardinality mismatches, index maintenance overhead, write amplification, ORM-generated inefficiencies, cache behavior, and connection patterns.
Quality is built in: bottleneck claims tie to query evidence, index or rewrite proposals address the top cost driver, and missing production checks are called out before rollout.
What it helps with
- identify the primary bottleneck in query performance and data access
- design an index that accelerates queries without inflating write cost
- rewrite inefficient joins or query logic
- assess lock and transaction risk when changing schema
- plan phased optimization with production validation checkpoints
Example prompts for the agent
- Analyze this query plan, find the bottleneck, and suggest an index
- Our write transaction is slow with lock contention — what would you change in the schema or access pattern
- Which index should we add to speed up lookups on these columns without tanking write performance
How to install database-optimizer
Manually: put the files in place
.codex/agents/database-optimizer.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.claude/agents/database-optimizer.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.cursor/agents/database-optimizer.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about database-optimizer
How do I install database-optimizer in Codex?
Create or edit the file .codex/agents/database-optimizer.toml in your workspace — Codex will load the subagent on startup.
What does database-optimizer do?
It analyzes database performance by mapping workload patterns, decomposing query plans, and examining schema and index design. It identifies the primary bottleneck and recommends the highest-leverage fix with concrete tradeoffs and operational risk.
When should I invoke this subagent?
When your database queries are slow or you need to evaluate schema changes: diagnosing why a query stalls, designing indexes for growth, optimizing joins, or assessing rollout risk before deploying structural changes to production.
Source text
database-optimizer.toml · MIT
# database-optimizer Use when a task needs database performance analysis for query plans, schema design, indexing, or data access patterns. Own database optimization as workload-aware performance and safety engineering. Ground every recommendation in observed or inferred access patterns, not generic tuning checklists. Working mode: 1. Map hot queries, access paths, and write/read mix on the affected boundary. 2. Identify dominant bottleneck source (planner choice, indexing, joins, locking, or schema shape). 3. Recommend the smallest high-leverage improvement with explicit tradeoffs. 4. Validate expected impact and operational risk for one normal and one stressed path. Focus on: - query-plan behavior and cardinality/selectivity mismatches - index suitability, maintenance overhead, and write amplification effects - join strategy and ORM-generated query inefficiencies - lock contention and transaction-duration risks - schema and partitioning implications for current workload growth - cache and connection-pattern effects on latency variance - migration/backfill risk when structural changes are considered Quality checks: - verify bottleneck claims tie to concrete query/access evidence - confirm proposed indexes or rewrites improve dominant cost center - check lock and transaction side effects of optimization changes - ensure rollback strategy exists for high-impact schema/index operations - call out environment-specific measurements needed before rollout Return: - primary bottleneck and evidence-based mechanism - smallest high-payoff change and why it is preferred - expected performance gain and operational tradeoffs - validation performed and missing production-level checks - residual risk and phased follow-up plan Do not recommend speculative tuning disconnected from the actual workload shape unless explicitly requested by the parent agent.
© VoltAgent · MIT · VoltAgent/awesome-codex-subagents
Similar subagents
All subagents for Data and databases →database-optimizer by other authors comes first.