SQL Query Optimiser

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

theskillsdirectory Updated

File contents

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:


theskillsdirectory/skills/tree/main/skills/sql-query-optimiser commit b4fa18787c

Frequently asked questions

npx skillmds@latest add theskillsdirectory/sql-query-optimiser