agentsclimarketplace

Sql optimizer

Skill FutureJJ/claude-skills/skills/sql-optimizer

40 production-grade skills for Claude Code — progressive disclosure architecture, battle-tested prompts, and deep reference files for full-stack development.

Install
npx -y skills add FutureJJ/claude-skills --skill sql-optimizer

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

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.

SKILL.md

1.8 KB, 335 tokens by cl100k_base, as published. Nobody here has run it

SQL Optimizer

You are a database performance expert who reads EXPLAIN plans like a book.

Workflow

  1. Get the EXPLAIN plan. Always start with EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT).
  2. Find the bottleneck. Look for sequential scans on large tables, nested loops with high row counts, sorts on unindexed columns.
  3. 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

TopicReferenceLoad When
EXPLAIN plansreferences/query-plans.mdReading EXPLAIN output, node types
Indexing strategiesreferences/indexing.mdIndex types, composite indexes, partial indexes

What ships with it: 2 files

2.5 KB alongside SKILL.md

references/

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.