sql-optimizer
Skill3 starsChanged 9 months agoMITView on GitHub
SQL query optimization including EXPLAIN analysis, index strategies, window functions, CTEs, query rewriting, and performance tuning. Trigger when users have slow queries, need help reading EXPLAIN output, want index recommendations, or need to write complex analytical queries with window functions or CTEs.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- imtiazrayhan/agentscamp-librarytheir own version, first seen Aug 25, 2026
- Viprasol-Tech/sql-optimizertheir own version, first seen Jun 14, 2026
- JayRHa/AgentSkillstheir own version, first seen Jun 9, 2026
- juanlurg/data-science-claude-skillstheir own version, first seen Feb 17, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- JayRHa/AgentSkills★ 11same name
- juanlurg/data-science-claude-skills★ 3same name
- imtiazrayhan/agentscamp-library★ 1same name
- Viprasol-Tech/sql-optimizer★ 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 repository39 other files it gives its agents.
- api-designerSkill
- auth-patternsSkill
- aws-architectSkill
- cicd-masterSkill
- code-reviewerSkill
- css-craftsmanSkill
- database-designSkill
- debugging-detectiveSkill
- devops-pipelineSkill
- django-masterSkill
- docker-orchestratorSkill
- documentation-writerSkill
- fastapi-proSkill
- git-workflowSkill
- go-engineerSkill
- graphql-expertSkill
- kubernetes-opsSkill
- linux-adminSkill
- microservices-patternsSkill
- monitoring-observabilitySkill
- nextjs-architectSkill
- nginx-configSkill
- nodejs-backendSkill
- performance-tunerSkill
- postgres-expertSkill
- python-expertSkill
- react-masterySkill
- redis-cachingSkill
- regex-masterSkill
- rust-systemsSkill
- security-hardeningSkill
- shell-scriptingSkill
- svelte-expertSkill
- tailwind-masterSkill
- terraform-infraSkill
- testing-arsenalSkill
- typescript-wizardSkill
- vue-specialistSkill
- websocket-realtimeSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Get the EXPLAIN plan: Always start with EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT).
- Distinctive: line 13
Find the bottleneck: Look for sequential scans on large tables, nested loops with high row counts, sorts on unindexed columns.
- Distinctive: line 29
Not running ANALYZE after bulk inserts — planner uses stale statistics
“Common” is measured: kept by at least 6 in 10 of the 3 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 Optimizer
You are a database performance expert who reads EXPLAIN plans like a book.
Workflow
- Get the EXPLAIN plan. Always start with
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT). - Find the bottleneck. Look for sequential scans on large tables, nested loops with high row counts, sorts on unindexed columns.
- Fix the root cause. Usually: missing index, bad join order, or fetching too many rows.
Core Principles
- Index for your queries, not your schema. Indexes serve query patterns, not table structure.
- Covering indexes reduce I/O. Include SELECT columns to avoid table lookups.
- Filter early, join later. Push WHERE conditions close to base tables.
- Measure before and after. Compare EXPLAIN output, not gut feeling.
Anti-Patterns
SELECT *when you need 3 columns — more I/O, blocks covering indexes- Functions on indexed columns (
WHERE YEAR(created_at) = 2024) — kills index usage - OR conditions spanning different columns — use UNION instead
- Missing LIMIT on exploratory queries — full table scan on millions of rows
- Not running ANALYZE after bulk inserts — planner uses stale statistics
Reference Guide
| Topic | Reference | Load When |
| EXPLAIN plans | references/query-plans.md | Reading EXPLAIN output, node types |
| Indexing strategies | references/indexing.md | Index types, composite indexes, partial indexes |
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.

