Skip to content
Skills Library
Programming · Analysis

database-query-performance

/database-query-performance

Diagnose database latency with explain plans, index ownership, and query-shape review. Use when a query is slow, an index is missing, or scans and N+1 patterns appear.

Licence
MIT
Last repository change
22.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Diagnose database latency with explain plans, index ownership, and query-shape review. Use when a query is slow, an index is missing, or scans and N+1 patterns appear.

Original author description

Diagnose database latency with explain plans, index ownership, and query-shape review. Use when a query is slow, an index is missing, or scans and N+1 patterns appear.

How it works

  1. Priority: P0 (CRITICAL)
  2. Rules
  3. Verify
  4. Anti-Patterns
  5. References
Original SKILL.md headings · 31 lines, 154 words
SKILL.md preview
---
name: database-query-performance
description: Diagnose database latency with explain plans, index ownership, and query-shape review. Use when a query is slow, an index is missing, or scans and N+1 patterns appear.
metadata:
  triggers:
    files:
    - '**/*.sql'
    - '**/*.entity.ts'
    - 'prisma/schema.prisma'
    keywords:
    - slow query
    - explain
    - index
    - scan
    - n+1
---
# Database Query Performance

## **Priority: P0 (CRITICAL)**

Slow query work starts with the query shape and evidence, not with random index creation.

## Rules

- Capture the exact query, parameters, and access path.
- Run explain or equivalent plan inspection before adding indexes.
- Match indexes to filter, join, sort, and coverage needs.
- Fix N+1 at the query pattern or loading strategy, not by caching first.

## Verify

- [ ] Explain plan was reviewed.
- [ ] Proposed index maps to a named query path.
- [ ] Write cost of the index is acceptable.
- [ ] Pagination or batch loading avoids deep scans or N+1 loops.

## Anti-Patterns

- **No blind indexes**: every index needs a query owner.
- **No cache-first latency fix**: fix query shape before hiding it.
- **No ORM opacity**: inspect generated SQL when the ORM is involved.

## References

- [Framework Map](../references/framework-map.md)
- [Index Strategies](references/index-strategies.md)
Files in this package (3)
  • SKILL.md 1 KB
  • evals/evals.json 1 KB
  • references/index-strategies.md 2 KB

Versions

The database has no other skills named database-query-performance.

Database snapshot: 13.11.2026 · package version 4225b0e44e60 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100database-slow-query-logging-optimization
    Use this skill when capturing, analyzing, and tuning slow database queries using slow query logs and automated index recommendations.
  • 95database
    Guide database design, migration, and query optimization. Use when: schema design, migration planning, query optimization, index strategy. Not for: application code migration or framework upgrades — use /migrate; the API contract over the data — use /api-design. Keywords:…
  • 100database-optimizer
    Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.
  • 100database-optimizer
    Optimizes database queries and improves performance across PostgreSQL and MySQL systems. Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies,…
  • 100flux-query
    Optimize slow database queries — analyze execution plans, add indexes, rewrite queries. Use when asked about "slow query", "optimize SQL", "query performance", or "explain this query".
  • 100database-optimization
    Schema design, index strategy, migration safety, and query analysis. TRIGGER when: designing tables or indexes, writing a migration, or diagnosing a slow query. SKIP: writing ORM model code (use python-patterns); generic backend patterns (use python-patterns).

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.