SQL Query Analyzer Online
Paste your SQL query to get detailed statistics — table count, JOIN complexity, subquery depth, and performance warnings. Readable by the MySQL, PostgreSQL, SQL Server and SQLite syntax most teams mix in a single repo. All analysis runs in your browser.
Input SQL
Complexity Score
What is the SQL Query Analyzer?
The SQL Query Analyzer inspects a query you paste in and reports a detailed breakdown of its structure. It counts the tables referenced, classifies each JOIN type (INNER, LEFT, RIGHT, CROSS, FULL, NATURAL), measures subquery depth, and tallies CTEs, aggregate functions, window functions, DISTINCT keywords, and UNION branches. On top of the raw numbers, it assigns a complexity score from 1 (simple) to 10 (extremely complex) and flags common performance antipatterns such as SELECT *, missing WHERE clauses, too many JOINs, deep nesting, and CROSS JOINs without a condition. All analysis happens client-side in your browser, so your SQL never leaves your device and you can analyze unlimited queries for free. The complexity score bands are easy to read at a glance: 1–3 is simple, 4–6 is moderate, and 7–10 is highly complex, so you can triage queries before digging into the full breakdown of tables, JOINs, and subqueries.
How to Analyze a SQL Query
- Paste your SQL into the
Input SQLtext area. - Optionally click one of the example buttons —
Simple SELECT,Multi-JOIN,CTE + Window, orComplex Query— to load a sample. - Click the
Analyzebutton. - Review the summary cards (tables, JOINs, subquery depth, CTEs, aggregates, and more) and the color-coded complexity meter.
- Scroll down to read the performance and style warnings, then adjust your query accordingly.
Common Use Cases
- Reviewing a teammate's query to gauge how hard it will be to maintain.
- Catching accidental
SELECT *or missing WHERE clauses before code review. - Measuring the complexity of a legacy query before refactoring it into CTEs.
- Spotting excessive JOINs that might justify denormalization or an index.
- Comparing two versions of a query to confirm the simpler one still does the job.
- Estimating how long a query will take to debug from its subquery depth and JOIN count.
Example: Reading the Complexity Score
Paste this query to see how the analyzer scores it:
The analyzer will report 2 tables and 1 LEFT JOIN, note the presence of GROUP BY, HAVING, and ORDER BY clauses, and assign a low-to-moderate complexity score. Because the query avoids SELECT *, includes a WHERE clause, and uses only a single join, the warning list stays empty and the score lands in the low-to-moderate range.
Tips for Using the Analyzer Effectively
Treat the complexity score as a signal, not a verdict — a high score on an analytics query is often justified, while a high score on a simple lookup is worth investigating. Pay closest attention to the danger warnings (missing WHERE on UPDATE/DELETE, CROSS JOIN without a condition), as those can cause real data problems. Run the analyzer on your queries before they reach production, and use the deep-nesting warning to guide you toward breaking subqueries into readable CTEs. If you frequently review similar queries, use the example loaders to compare a candidate against a known sample and see how its score ranks.
SQL Query Analyzer Online — What It Checks
Most SQL analyzers in a search result want an install: the SSMS Query Analyzer ships inside SQL Server Management Studio, Visual Explain ships inside MySQL Workbench, and pgAdmin is a desktop app. This one is a page. Open it, paste the query, click Analyze, and the numbers come back immediately — no connection string, no credentials, no local database, and nothing uploaded.
A run reports tables referenced (deduplicated, so a self-join is counted once), JOIN count and type (INNER, LEFT, RIGHT, FULL, CROSS, NATURAL), subquery depth, CTE count, aggregate functions, window functions, DISTINCT usage and UNION branches, plus statement type and line count. It then compiles a 1–10 complexity score and a warning list split into danger items (missing WHERE on UPDATE or DELETE, CROSS JOIN without a condition) and info items (SELECT *, deep nesting, DISTINCT on a large join).
Those warnings are structural, which is what makes them useful before code review: they describe how hard the query will be to maintain and roughly how much work the planner faces, with no running database involved. If all you want to know is whether the SQL parses, run it through the SQL validator first; if you want to see how the engine plans it, paste the plan into the EXPLAIN visualizer.
Query Analyzer for MySQL, PostgreSQL and SQL Server
"Query analyzer" means something different in every database, so it is worth being precise about which one you need.
- SQL Server / T-SQL — the original SSMS Query Analyzer was split into the query editor, the execution plan and Query Store. Real metrics still need the engine;
SET STATISTICS IO ONis the fastest way to see logical reads per table. - MySQL / MariaDB —
EXPLAINandEXPLAIN ANALYZEin the shell, Visual Explain in MySQL Workbench, and the slow query log for statements already running in production. - PostgreSQL —
EXPLAIN (ANALYZE, BUFFERS)for one query, and thepg_stat_statementsextension to rank the slowest statements across an instance. - SQLite —
EXPLAIN QUERY PLAN, or nothing at all if you only want the structure counted.
This analyzer does not replace any of them — it is dialect-agnostic, so a T-SQL query using TOP, a MySQL query with LIMIT and a PostgreSQL query with RETURNING or ON CONFLICT are all counted the same way. The workflow that holds up: count the structure here to see how complex the query really is, move it between vendors with the SQL dialect converter when you are migrating, keep the vendor-specific version readable with the PostgreSQL formatter or the MySQL formatter, and take the reads and timings from the engine itself.
SQL Query Performance Analyzer: What the Statistics Can and Cannot Tell You
The honest description is that this is a static analyzer — it reads the query, not the database. Its statistics are about shape: how many tables the planner has to join, how deeply the subqueries nest, and whether the query leans on features (window functions, DISTINCT, UNION) that narrow the plans available to the optimizer.
What it cannot tell you is cost. STATISTICS IO output — scan count, logical reads, physical reads — and a real execution plan only exist once a server runs the query against real data with real indexes. So the two halves of performance work stay separate:
- Structure, before you run anything: table count, JOIN types, subquery depth, CTE usage, missing WHERE,
SELECT *. Spot and fix the antipatterns here — it is free. - Cost, after you run it: the actual plan, reads and index usage. Start with how to read a SQL EXPLAIN plan, then read how database indexes work if you see a scan where you expected a seek.
A high complexity score is not automatically a problem — reporting queries are supposed to be complex. The useful signal is a change: a query that scored 3 last month and scores 7 today means somebody added joins or nesting that nobody reviewed. Analyze the rewritten query before you merge it, use the SQL diff tool to confirm exactly what changed in the text, and the SQL minifier when you need the same query compressed into a log line or a comment. Longer reads on the same subject live in SQL query optimization tips and subquery vs join.
Frequently Asked Questions
How does the SQL query analyzer work?
The SQL query analyzer parses your SQL query using a heuristic-based engine that counts tables, JOIN operations, subqueries, CTEs, and detects common performance patterns. It runs entirely in your browser — no data is sent to any server. It assigns a complexity score from 1 (simple) to 10 (extremely complex) based on query characteristics.
What performance issues can the SQL analyzer detect?
The analyzer detects several common performance antipatterns: SELECT * (which pulls unnecessary columns), missing WHERE clauses on SELECT/DELETE/UPDATE statements, CROSS JOINs without conditions, DISTINCT on large JOINs, nested subqueries that could be CTEs, and SELECT FROM subqueries without proper filtering.
Is the SQL query analyzer really free?
Yes, completely free. No signup, no credit card, no usage limits. All analysis runs client-side in your browser. You can analyze unlimited SQL queries — simple SELECTs or complex multi-CTE queries with dozens of JOINs.
What's the complexity score range?
The complexity score ranges from 1 to 10. Score 1-3: simple queries (few tables, no subqueries). Score 4-6: moderate complexity (JOINs, basic subqueries). Score 7-8: complex queries (multiple CTEs, nested subqueries, many JOINs). Score 9-10: extremely complex queries with extensive nesting, many CTEs, and complex JOIN patterns.
Do I need to install anything to use the SQL analyzer online?
No. The analyzer is a browser page — open it, paste your SQL, click Analyze. There is no extension, desktop app or database connection to set up, and no account. That is the main difference from a built-in analyzer such as the SSMS Query Analyzer or MySQL Workbench Visual Explain, which require the database engine and client tools to be installed locally.
Does the SQL query analyzer support MySQL, PostgreSQL and SQL Server syntax?
Yes. The statistics are produced from dialect-agnostic heuristics, so MySQL, PostgreSQL, SQL Server (T-SQL), SQLite and MariaDB queries are all analyzed. It recognises dialect-specific constructs such as TOP, LIMIT, FETCH FIRST, ILIKE, RETURNING, ON CONFLICT and backtick or bracket quoting. Because it does not connect to a database engine, it cannot fail on syntax a single vendor would reject — treat the output as a structural overview, not a syntax verdict.
Can the analyzer read an execution plan or STATISTICS IO output?
No. It analyzes the SQL text you paste, so it measures structure — tables, JOINs, subquery depth, CTEs, aggregates and complexity. It cannot see runtime cost. STATISTICS IO counters (scan count, logical reads, physical reads) and EXPLAIN plans come from the engine executing the query. The usual workflow is: analyze the SQL structure here first, then run EXPLAIN or STATISTICS IO in your database and read the plan with the EXPLAIN visualizer.
Is a SQL query analyzer the same thing as a SQL profiler?
No. A profiler (SQL Server Profiler, MySQL slow query log, pg_stat_statements) records queries while they actually run against a live database and reports duration, waits and reads. A query analyzer inspects the SQL text before or after execution and reports its structure and complexity. Use the profiler to find which queries are slow in production, and the analyzer to see why a specific query is hard to read, refactor or review.
Is a SQL query analyser the same as a SQL query analyzer?
Yes — analyser and analyzer are the British and American spellings of the same tool. This page answers to both: an SQL query analyser here reports table counts, JOIN types, subquery depth, CTE and aggregate counts, a 1-10 complexity score and performance warnings.