sql-optimization
Skill4 starsChanged 5 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.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- github/awesome-copilottheir own version, first seen Sep 23, 2026
- totvs/engpro-advpl-tlpp-skillstheir own version, first seen May 28, 2026
- bmsuisse/skillstheir own version, first seen Apr 21, 2026
- iCesofT/awesome-aitheir own version, first seen Apr 16, 2026
- snickerjp/Agent-Skillstheir own version, first seen Mar 28, 2026
- Ryanb58/agentskillstheir own version, first seen Feb 22, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- github/awesome-copilot★ 40ksame name
- totvs/engpro-advpl-tlpp-skills★ 138same name
- stefan-jansen/claude-code-toolkit★ 87same name
- bmsuisse/skills★ 2same name
- iCesofT/awesome-ai★ 1same name
- Ryanb58/agentskills★ 0same name
- snickerjp/Agent-Skills★ 0same name
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 7 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 7 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.

