database-query-diagnosis

database-query-diagnosis is a skill for Claude Code, Codex from dayfinggg/openai-codex-agent-skills. It costs 40 tokens per session (375 once invoked), scanned A, original, MIT.

A method for finding why database queries or connections are slow by examining real queries, execution plans, locks, and workload evidence. An execution plan shows how a database intends to run a query.

In plain words
What is it for?
Use it to investigate slow SQL, lock waits, connection-pool exhaustion, high latency, and throughput problems, then test the smallest supported correction.
Why use it?
It separates query work from connection waits, network delay, application processing, lock contention, and server overload instead of guessing from symptoms.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to investigate slow SQL, lock waits, connection-pool exhaustion, high latency, and throughput problems, then test the smallest supported correction.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dayfinggg/openai-codex-agent-skills --skill database-query-diagnosis
Clone the repo
git clone --depth 1 https://github.com/dayfinggg/openai-codex-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for database-query-diagnosis

README.md
[![agentmods](https://agentmods.dev/badge/skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis/github.svg)](https://agentmods.dev/skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis)
Your own site
<a href="https://agentmods.dev/skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis"><img src="https://agentmods.dev/badge/skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for database-query-diagnosis

Your own site · 80×15
<a href="https://agentmods.dev/skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis"><img src="https://agentmods.dev/badge/skills/dayfinggg/openai-codex-agent-skills/database-query-diagnosis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 375 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00040 $0.00375
Opus 5.5 $0.00016 $0.00150
Sonnet 5.5 $0.00008 $0.00075
Haiku 4.5 $0.00004 $0.00038

Measured today against content hash fbe7873a8d5c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

database-query-diagnosis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

codex/skills/database-query-diagnosis/SKILL.md · 20 lines

What it actually says

Locate the database bottleneck with evidence from the affected workload.

  1. Establish the engine, version, database, role, time interval, query fingerprint, parameters, and user-visible symptom. Separate execution time from connection checkout, network time, and application materialization.
  2. Inspect the schema, constraints, indexes, statistics, expected result grain, and relevant transaction boundaries. Reuse existing authorized access and keep queries bounded.
  3. Read a plain execution plan where appropriate. Before EXPLAIN ANALYZE, inspect side effects and workload cost because it executes the statement. Use a safe representative environment when execution would exceed authorization.
  4. Examine estimated and actual rows, loops, filtering, sort or hash spills, access paths, and wait events where available. A sequential scan or filesort is not automatically a defect.
  5. For locking, identify blockers, transaction age, lock ordering, and application retry behavior. For connections, separate pool configuration, leaks, long transactions, and server saturation.
  6. Test the smallest plausible correction against counterevidence. Consider index write cost, parameter sensitivity, result correctness, and other consumers before changing a shared object.
  7. Compare equivalent inputs, data, concurrency, and cache conditions before and after. Verify row identity and ordering as well as latency. Stop when the reported issue is resolved and the relevant regression check passes.

Use installed PostgreSQL, MongoDB, Redis, or ClickHouse specialists when their engine-specific procedure applies. Do not broaden production scans or terminate sessions merely to simplify investigation.

Consult the engine's official plan and monitoring documentation. Distinguish a suspected bottleneck from a reproduced and measured cause.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 20 lines · 40 tokens per session scan A fbe7873a8d5c

Subscribe to this mod's changes

database-query-diagnosis is a skill published in the GitHub repository dayfinggg/openai-codex-agent-skills (8 stars, last pushed today), licensed MIT. It adds 40 tokens to every session and 375 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-30.

Related

Other skills, from other repositories

oracle-sql-diagnosis

Use when the answer needs Oracle SQL evidence (read-only), or when Java code touches the database - to prove behavior on the data and assess the impact of the Java change.

gabrielrovesti/ai-agent-skills · 42 tokens

prisma-connection-pool-exhaustion

Fix Prisma "Too many connections" and connection pool exhaustion errors in serverless environments (Vercel, AWS Lambda, Netlify). Use when: (1) Error "P2024: Timed out fetching a new connection from the pool", (2) PostgreSQL "too many connections for role", (3) Database works locally but fails in production…

magic3007/dotfiles · 100 tokens

triage-issues

Triage GitHub issues in the googleapis/mcp-toolbox repo: propose the correct labels (type / priority / product / status), check for duplicates, verify a bug has enough info to act on, and draft a triage comment. Use whenever a maintainer asks you to triage, label, categorize, prioritize, or "look at" an issue (or a…

googleapis/mcp-toolbox · 164 tokens

graphjin-eval

Create, extend, run, baseline, and diagnose GraphJin agent evaluations through the graphjin eval CLI.

dosco/graphjin · 27 tokens

read-only-investigation

Use this reference when a user asks to investigate unexpected rows, a failed read, a slow query or a metadata mismatch without changing database state.

Syngnat/GoNavi · 0 tokens

mma-investigator

Expert system for investigating MMA (Multi-Metric Allocator) behavior on CockroachDB clusters. Helps oncall engineers diagnose load imbalances, understand rebalancing decisions, and identify why MMA did or didn't act.

cockroachdb/cockroach · 47 tokens