SQL Query Analyzer

Find expensive SQL patterns, missing filters and index opportunities.

Works Offline
Privacy First
No Login
No API

SQL query

Static analysis only — the query is never executed and never leaves your browser.

Analysis

Cost
46 · High
Joins
2
Subqueries
0
Issues
0E / 4W

Tables: orders, customers, order_items

  • warningSELECT * returns every column

    Wildcard projections read and transfer columns the application may never use, and they break silently when the table changes.

    List only the columns you need: SELECT id, name, created_at …

  • warningLeading-wildcard LIKE

    A pattern that starts with % cannot use a B-tree index, so it forces a full scan.

    Anchor the pattern (LIKE 'abc%'), or use a full-text / trigram index.

  • warningFunction applied to a filtered column

    Wrapping a column in a function makes the predicate non-sargable, so the index on that column is ignored.

    Rewrite the predicate (e.g. col >= '2026-01-01' AND col < '2026-02-01') or add a functional/expression index.

  • infoORDER BY without LIMIT

    Sorting the full result set costs memory and may spill to disk.

    Add LIMIT/OFFSET, or sort in the application when the set is small.

  • warningLarge OFFSET pagination

    OFFSET N still reads and discards N rows on every page.

    Use keyset pagination: WHERE id > :last_id ORDER BY id LIMIT :n.

Suggested indexes

CREATE INDEX idx_o_status ON o (status);
CREATE INDEX idx_c_id ON c (id);
CREATE INDEX idx_o_customer_id ON o (customer_id);
CREATE INDEX idx_i_order_id ON i (order_id);
CREATE INDEX idx_o_id ON o (id);

Hints are derived from WHERE, ON and ORDER BY columns — verify against your real cardinality and existing indexes.

About the SQL Query Analyzer

Paste a SQL statement to get a static review: SELECT *, missing WHERE clauses, UPDATE/DELETE without filters, leading-wildcard LIKE, non-sargable functions on filtered columns, NOT IN subqueries, implicit cross joins, joins without ON, deep OFFSET pagination, UNION versus UNION ALL and more — plus a cost estimate and ready-to-run CREATE INDEX suggestions.

Examples

Wildcard select

SELECT * FROM orders

Output

Warning: SELECT * and no WHERE clause

Keyboard shortcuts

  • Copy the main outputCtrl / ⌘ + Shift + C
  • Download the resultCtrl / ⌘ + S
  • Share this toolCtrl / ⌘ + Shift + S
  • Reset the inputsAlt + R
  • Open the tool search paletteCtrl / ⌘ + K

Related tools

Frequently asked questions

Version 1.0.0 · Updated 2026-08-17 · Runs entirely in your browser