# SQL Query Optimiser

> Analyses and optimises SQL queries for performance, readability and production safety

- Skill: `theskillsdirectory/sql-query-optimiser` (Agent Skill)
- Install (CLI): `npx skillmds@latest add theskillsdirectory/sql-query-optimiser`
- Raw SKILL.md: https://api.skillmd.com/api/skills/theskillsdirectory/sql-query-optimiser/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- License: apache-2.0
- Author: theskillsdirectory (https://skillmd.com/u/theskillsdirectory)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/theskillsdirectory/sql-query-optimiser

---


## What this skill does

Reviews SQL queries and suggests improvements for performance, readability, and safety. Identifies common issues like missing indexes, N+1 patterns, unoptimised joins, and queries that could cause problems in production.

## When to use it

- You've written a query and want a second opinion before running it in production
- A query is running slowly and you need to diagnose why
- You want your SQL reformatted to a consistent style
- You're learning SQL and want explained improvements

## Trigger phrases

- "Optimise this SQL query"
- "Review my SQL"
- "Why is this query slow?"
- "Rewrite this query to be more efficient"
- "Check this SQL before I run it in production"

## Example

**Before:**
```sql

