CtrlK
BlogDocsLog inGet started
Tessl Logo

sql-optimization-patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

81

1.00x
Quality

62%

Does it follow best practices?

Impact

94%

1.00x

Average score across 6 eval scenarios

SecuritybySnyk

Passed

No known issues

Optimize this skill with Tessl

npx tessl skill review --optimize ./plugins/developer-essentials/skills/sql-optimization-patterns/SKILL.md
SKILL.md
Quality
Evals
Security

Evaluation results

90%

Optimizing a Slow User Activity Report

N+1 elimination and subquery optimization

Criteria
Without context
With context

No loop queries

100%

100%

Single aggregate query

100%

100%

No correlated subquery

100%

100%

No SELECT *

100%

100%

JOIN-based aggregation

100%

100%

Filter before aggregation

100%

100%

Correct aggregation

100%

100%

CTE or subquery clarity

0%

0%

Notes explain N+1

100%

100%

Notes explain fix

100%

100%

94%

-3%

Designing an Index Strategy for a Content Publishing Platform

Index design and selection strategy

Criteria
Without context
With context

GIN full-text index

100%

100%

GIN JSONB index

100%

100%

Expression index for email

100%

100%

Partial index for published status

100%

100%

Composite index column order

100%

100%

Cursor pagination index

70%

70%

Cursor-based query provided

100%

100%

No leading wildcard LIKE

100%

100%

Index type rationale

100%

100%

Selective indexing awareness

100%

70%

100%

5%

PostgreSQL Performance Audit and Remediation

Performance audit and advanced optimization

Criteria
Without context
With context

pg_stat_statements query

100%

100%

Missing index detection

70%

100%

Unused index detection

100%

100%

Materialized view creation

100%

100%

Concurrent materialized refresh

100%

100%

Batch UPDATE not loop

100%

100%

Temp table for large batch

100%

100%

pg_class approximate count

100%

100%

VACUUM ANALYZE maintenance

75%

100%

Materialized view index

100%

100%

96%

3%

Query Plan Diagnosis Package

EXPLAIN plan analysis and interpretation

Criteria
Without context
With context

Full EXPLAIN flags

100%

100%

Seq Scan as slow signal

100%

100%

Index Only Scan as best

62%

100%

Join method discussion

50%

50%

Cost field interpretation

100%

100%

Actual time interpretation

100%

100%

Rows estimate vs actual

100%

100%

Expression index recommendation

100%

100%

JOIN aggregation recommendation

100%

100%

Cursor pagination recommendation

100%

100%

92%

Orders Database Redesign for Scale

Table partitioning and bulk INSERT operations

Criteria
Without context
With context

PARTITION BY RANGE syntax

100%

100%

Partition OF syntax

100%

100%

Four Q1-Q4 partitions

100%

100%

Single batch INSERT

100%

100%

No SELECT * in inserts

100%

100%

Batch UPDATE with IN clause

100%

100%

No per-row update loop

100%

100%

Partition pruning explanation

100%

100%

COPY mention for large data

0%

0%

94%

-6%

Legacy Query Audit and Optimization

OR conditions, implicit type conversion, and covering indexes

Criteria
Without context
With context

Fix implicit type conversion

100%

100%

Index for account_number

100%

100%

OR condition diagnosis

100%

100%

OR rewritten with UNION

100%

100%

Explicit JOIN syntax

100%

100%

Covering index for fraud query

100%

100%

Composite index column order for Query 4

100%

40%

Index for billing aggregation

100%

100%

Type conversion explanation

100%

100%

No SELECT * in rewrites

100%

100%

Repository
wshobson/agents
Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.