Back to SQLGenie

Free SQL Query Optimizer

A slow query almost always comes down to a handful of causes — a missing index, a full table scan, SELECT *, or a function wrapped around the filtered column. Paste yours into Fix My SQL and get a faster rewrite with the reasoning in plain English.

What a slow query looks like — and its fix

This query scans every row in orders, uppercases every email, and sorts the whole table — slow on anything but a tiny dataset:

SELECT *
FROM orders
WHERE UPPER(email) = 'ANA@EXAMPLE.COM'
ORDER BY created_at;

The optimized version removes the function so the index works, fetches only the columns needed, and caps the sort with a LIMIT:

SELECT id, email, total, created_at
FROM orders
WHERE email = 'ana@example.com'
ORDER BY created_at DESC
LIMIT 50;
-- plus: CREATE INDEX idx_orders_email ON orders(email);

Three small changes, often 100–1000x faster on large tables. Try it — the button above loads this exact query into Fix My SQL.

The six causes behind most slow queries

Functions on the filtered column

Wrapping a column in a function like UPPER(email) or DATE(created_at) stops the database from using a normal index, forcing a full table scan. Move the transformation to the search value, or add a functional index.

SELECT * on wide tables

Fetching every column reads more data than you need and prevents covering-index optimisation. Select only the columns the page or report actually uses.

Missing indexes on JOIN and WHERE columns

If a join key or filter column has no index, every query scans the whole table. Indexes on foreign keys and frequently filtered columns are the single biggest win for slow queries.

Sorting without a LIMIT

ORDER BY forces the database to sort the entire result set before returning rows. Adding a LIMIT, or an index that matches the sort order, avoids that work.

N+1 queries from application code

Loading a list and then running one query per row multiplies round trips. Replace the loop with a single JOIN or an IN(...) query.

Implicit type conversions

Comparing a string column to a number (or the reverse) silently converts every row and disables indexes. Match the column's type in your query.

Frequently asked

Is this SQL query optimizer free?

Yes. Paste a slow query into SQLGenie's Fix My SQL mode and it suggests a rewritten, faster version with an explanation of what changed and why. No account needed.

Which databases does it help with?

The advice and rewrites cover MySQL, PostgreSQL, SQL Server, SQLite, Oracle, BigQuery and Snowflake. Pick your database in the dropdown so index and syntax suggestions match your dialect.

Can it add indexes for me?

It suggests the exact CREATE INDEX statement when a missing index is the likely cause. You review and run it yourself — SQLGenie never connects to your database, so nothing changes without you.

How is this different from EXPLAIN?

EXPLAIN shows you the query plan; SQLGenie interprets it for you. Paste the slow query (and your schema if you have it) and you get the likely bottleneck, a faster rewrite, and the reasoning in plain English.

Stop guessing why it's slow

Paste your query — and your schema if you have it — and SQLGenie rewrites it faster, explains the bottleneck, and suggests the index to add. Free, no account, nothing stored.