SQL Performance Analyzer

Find performance anti-patterns in a SQL query and get ranked fixes

SQL query

Performance score

65
Grade C

3 findings

3 findings (1 high/critical). Prioritize the high-severity items for the biggest gains.

Findings & suggestions

high
LIKE with a leading wildcard cannot use an index
'%ada%'

A pattern starting with '%' forces a full scan. Consider full-text search, a trigram index, or restructuring so the pattern is prefix-anchored.

medium
SELECT * fetches every column
SELECT *

List only the columns you need. SELECT * transfers unneeded data and breaks when the schema changes.

low
ORDER BY without LIMIT
ORDER BY orders.created_at

Sorting an unbounded result set is expensive. Add LIMIT or paginate to bound the sort.

Examples

A full-scan LIKE

Input
SELECT * FROM users WHERE name LIKE '%ada%'
Output
Score reduced — SELECT * (medium) and leading-wildcard LIKE (high) flagged.

A leading wildcard defeats indexes and forces a full table scan; SELECT * fetches unneeded columns too.

A Cartesian product

Input
SELECT * FROM users, orders
Output
Critical — comma join / cross join without a join condition.

A comma join with no ON/WHERE pairs every row with every row. Use an explicit JOIN … ON.

About this tool

Most slow queries suffer from a small number of recurring mistakes, and you do not need a live database to spot them. This analyzer inspects SQL for the patterns that reliably hurt performance: SELECT *, leading-wildcard LIKE that defeats indexes, missing WHERE clauses, comma-style cross joins, NOT IN with its NULL pitfalls, functions applied to columns, ORDER BY without LIMIT, and UNION where UNION ALL would do.

Each finding is ranked by severity with a concrete suggestion, and the query gets an overall 0–100 performance score. The analysis is heuristic and schema-agnostic — it points at likely problems fast, but real tuning still depends on indexes, row counts, and the actual execution plan.

How to use

  1. Paste the query

    Enter the SQL statement you want to review.

  2. Read the score

    The 0–100 score and grade summarize how many anti-patterns are present.

  3. Work the findings

    Apply the high-severity suggestions first for the biggest performance gain.

  4. Verify with a plan

    Confirm each change with EXPLAIN and real data volumes.

Common mistakes

Mistake:Using leading-wildcard LIKE.

Fix:LIKE '%term' cannot use a normal index. Use full-text search or a prefix-anchored pattern.

Mistake:SELECT * for convenience.

Fix:List only needed columns to cut I/O and keep the query stable when the schema changes.

Frequently asked questions

References & standards