sql-optimization
Skill0 starsChanged 4 months agoMITView on GitHub
Universal SQL query tuning across MySQL, PostgreSQL, SQL Server, and Oracle — execution plans, index strategy, pagination, batch operations. Use whenever a SQL query is slow or needs optimization.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- reddygopalkrishna/developer-agent-skillstheir own version, first seen Nov 8, 2026
- bmsuisse/skillstheir own version, first seen Nov 6, 2026
- github/awesome-copilottheir own version, first seen Oct 25, 2026
- XGENT-ai/skillstheir own version, first seen Oct 13, 2026
- z-Zihan/Evirtheir own version, first seen Oct 13, 2026
- Adhamxon/claude-code-skillstheir own version, first seen Jul 30, 2026
Used with
Projects with it also use test-driven-development.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkilltest-driven-development
Use when implementing any feature or bugfix, before writing implementation code
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- github/awesome-copilot★ 41ksame name
- totvs/engpro-advpl-tlpp-skills★ 166same name
- z-Zihan/Evir★ 11same name
- reddygopalkrishna/developer-agent-skills★ 8same name
- Adhamxon/claude-code-skills★ 2same name
- bmsuisse/skills★ 2same name
- iCesofT/awesome-ai★ 1same name
- XGENT-ai/skills★ 1same name
- KenLiu0607/skills★ 0same name
- ReaperOAK/ForgeOS★ 0same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository63 other files it gives its agents.
- .claude/skills/nestjs-best-practices/AGENTS.mdAGENTS.md
- accessibility-a11ySkill
- architecture-blueprint-generatorSkill
- backend-delivery-loopSkill
- backend-designSkill
- backend-dev-guidelinesSkill
- backend-testingSkill
- backend-to-frontend-handoff-docsSkill
- building-componentsSkill
- bullmq-specialistSkill
- canvas-designSkill
- code-patternsSkill
- components-composition-patternsSkill
- conventional-commitSkill
- core-web-vitalsSkill
- create-svgSkill
- css-architectureSkill
- cypress-authorSkill
- cypress-docsSkill
- cypress-explainSkill
- delivery-loop-retroSkill
- diagnoseSkill
- fastify-best-practicesSkill
- figma-code-connectSkill
- frontend-delivery-loopSkill
- frontend-fundamentalsSkill
- fullstack-delivery-loopSkill
- grill-meSkill
- hunt-race-conditionSkill
- impeccableSkill
- mermaid-diagramsSkill
- nestjs-best-practicesSkill
- nextjs-best-practicesSkill
- nextjs-performanceSkill
- nodejs-backend-patternsSkill
- owasp-security-reviewSkill
- performance-hunterSkill
- playwright-best-practicesSkill
- postgresql-code-reviewSkill
- postgresql-optimizationSkill
- postmanSkill
- prisma-postgresSkill
- pro-state-machineSkill
- race-conditionSkill
- react-best-practicesSkill
- react-performanceSkill
- react-querySkill
- redis-coreSkill
- redis-query-engineSkill
- redis-securitySkill
- refactorSkill
- review-panelSkill
- run-delivery-chainSkill
- spec-drivenSkill
- system-designSkill
- testing-strategySkill
- tune-skills-and-agentsSkill
- ui-ux-pro-maxSkill
- vercel-react-view-transitionsSkill
- viteSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Keep predicates sargable: no functions wrapping indexed columns in WHERE.
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SQL Performance Optimization
You are a SQL performance specialist. Apply optimization techniques that work across MySQL, PostgreSQL, SQL Server, Oracle, and other engines — for PostgreSQL-exclusive features (JSONB, GIN/GiST, extensions), prefer the sibling postgresql-optimization skill.
Methodology
- Identify — find the slow queries with the engine's own tooling (slow log,
pg_stat_statements, query stats DMVs). - Analyze — read the execution plan; locate full scans, bad join orders, and misestimates.
- Optimize — rewrite the query and/or add the index its shape demands.
- Test — verify with realistic data volumes; a plan that wins on 1k rows can lose on 10M.
- Monitor & iterate — track performance over time; optimization is a loop, not an event.
Core Principles
- Keep predicates sargable: no functions wrapping indexed columns in WHERE; ranges over computed values.
- Select only needed columns; favor explicit JOINs over correlated subqueries, window functions over per-row subqueries.
- Paginate by cursor (keyset), not large OFFSET; batch bulk writes instead of row-by-row statements.
- Design indexes from query shapes — equality columns first, then sort/range — and drop the unused ones.
References
Each file is loaded on demand — read one only when the task needs that depth (progressive disclosure).
references/query-patterns.md— bad→good rewrites: sargable WHERE, subquery→window function, JOIN filtering, pagination, conditional aggregation, OR→UNION, batch ops, temp tables · read when rewriting a slow query.references/indexing.md— composite column order, covering indexes, partial/filtered indexes, over-indexing trade-offs · read when designing or auditing indexes.references/monitoring.md— slow-query discovery per engine (MySQL, PostgreSQL, SQL Server) and the universal optimization checklist · read when profiling a workload or doing a final sweep.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

