Not yet. Do not add “another index” until you know the exact query shape and access path. Start with evidence: - capture the exact SQL (or ORM-generated SQL), - include real filter parameters, - check how the list is sorted and paginated, - run `EXPLAIN` or `EXPLAIN ANALYZE`. That tells you whether the slowdown is actually caused by: - a full table scan, - an inefficient sort, - a bad join order, - missing index coverage, - offset pagination scanning too deeply, - or an N+1 fetch pattern arou...
Scanned 9/5/2026
Install to Claude Code
npx -y skills add HoangNguyen0403/agent-skills-standard --skill database-query-performance --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Database Query Performance?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-database-query-performance)More formats (shields.io, HTML) on the badges page.
Not yet. Do not add “another index” until you know the exact query shape and access path.
Start with evidence:
- capture the exact SQL (or ORM-generated SQL),
- include real filter parameters,
- check how the list is sorted and paginated,
- run `EXPLAIN` or `EXPLAIN ANALYZE`.
That tells you whether the slowdown is actually caused by:
- a full table scan,
- an inefficient sort,
- a bad join order,
- missing index coverage,
- offset pagination scanning too deeply,
- or an N+1 fetch pattern around related order data.
Only add an index if it maps to a specific query path. For an orders listing, the useful index usually follows the query’s actual pattern, for example:
- filters: `status`, `customer_id`, `created_at`
- sort: `created_at DESC`
- joins: foreign keys used in the listing
So if the query is:
```sql
SELECT id, status, total, created_at
FROM orders
WHERE customer_id = ?
AND status = ?
ORDER BY created_at DESC
LIMIT 50;
```
then an index like `(customer_id, status, created_at DESC)` may help because it matches the filter and sort path. But that conclusion should come from the explain plan, not guessing.
Also check the tradeoff: every new index adds write cost on inserts and updates. A good index must have a clear owner query and enough read benefit to justify that maintenance overhead.
If the plan shows the query already uses an index, the real fix may be:
- selecting fewer columns,
- switching from offset pagination to cursor/keyset pagination,
- batching related lookups to remove N+1 behavior,
- or rewriting the query shape so the database can use the right access path.
Recommended approach:
1. Inspect the exact query and parameters.
2. Run `EXPLAIN` / `EXPLAIN ANALYZE`.
3. Identify whether the bottleneck is scan, sort, join, pagination, or N+1.
4. Add or adjust an index only if it directly supports that named query path.
So the answer is: no, do not “just add another index.” Review the plan first, then add a query-owned index only if the evidence says it is the real fix.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!