Skip to content

Repository files navigation

SQL Visual Explorer

A native desktop tool for one job: find out why your query is slow.

Build & Test License: MIT .NET 10 Platforms


SQL Visual Explorer runs your query, parses its execution plan, and highlights the bottleneck — sequential scans, blown row estimates, hash joins spilling to disk, sorts that don't fit in memory.

It is not a general-purpose database client and does not try to replace DBeaver or DataGrip. It does one thing: turn an EXPLAIN ANALYZE output into an answer.

Features

  • Five databases, one interface — PostgreSQL, MySQL, MariaDB, SQLite, SQL Server
  • Query execution — resizable results grid, column sorting, CSV/JSON export
  • Plan visualization — tree, node graph, and flame-graph views, colour-coded by cost
  • Automatic issue detection — ten rules covering scans, joins, sorts, estimates, and index gaps
  • Plan comparison — run two variants side by side and get a cost/time/node-count diff with a winner
  • HTML reports — export a plan or a comparison as a self-contained HTML file
  • Snippets — save, tag, and search reusable SQL, recallable from a Ctrl+/ popup
  • Query history — every run is recorded locally; reopen the SQL or reload the saved plan
  • AI Advisor (optional) — send the query and detected issues to any OpenAI-compatible endpoint for rewrite suggestions
  • Read-only by designAnalyze refuses mutating statements and multi-statement batches
  • Credentials in the OS keychain — never in plaintext config

What it detects

Rule Fires when
Sequential scan A large row set is scanned without an index
Missing index hint A sequential scan carries a filter that an index could serve
Large nested loop A nested-loop join is driven by too many outer rows
High cost node A single node dominates total plan cost
Row estimate mismatch Planner estimate and actual rows diverge sharply
Large sort A sort processes a large row set
Hash join spill The hash table exceeds work_mem and spills to disk in multiple batches
Bitmap heap scan Informational — bitmap access path in use
Function in filter A function call wraps a column and blocks index use
Implicit cast A type cast in a filter blocks index use

Install

Download a build

Grab a self-contained binary from the Releases page — no .NET runtime required. Builds are published for win-x64, osx-x64, osx-arm64, and linux-x64.

On macOS, first launch requires Right click → Open (the binary is unsigned).

Build from source

Requires the .NET 10 SDK.

git clone https://github.com/Komortes/SQL-Visual-Explorer.git
cd SQL-Visual-Explorer
dotnet restore SQLVisualExplorer.sln
dotnet run --project src/SQLVisualExplorer.Desktop/SQLVisualExplorer.Desktop.csproj

Quick start

  1. Connections → add a connection; the password goes to the OS keychain, everything else to a local SQLite file.
  2. Editor → write a query and press Ctrl+Enter to run it.
  3. Press Ctrl+Shift+Enter to run EXPLAIN ANALYZE and jump to the plan.
  4. Click a node to inspect its cost, rows, timing, and any issues attached to it.
  5. Compare → paste an optimized variant and confirm it's actually faster.

Keyboard shortcuts

Shortcut Action
Ctrl+Enter Run query
Ctrl+Shift+Enter Explain analyze
Ctrl+Shift+F Format SQL
Ctrl+/ Open snippet picker
Ctrl+C Copy selected result rows

Supported databases

Database Driver Plan source
PostgreSQL Npgsql EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)
MySQL / MariaDB MySqlConnector EXPLAIN FORMAT=JSON, EXPLAIN ANALYZE
SQLite Microsoft.Data.Sqlite EXPLAIN QUERY PLAN
SQL Server Microsoft.Data.SqlClient SHOWPLAN_XML, STATISTICS XML

Where your data lives

What Location
Connections, history, snippets %LOCALAPPDATA% / ~/.local/shareSQLVisualExplorer/sqlvisualexplorer.db
Passwords & API keys (macOS) Keychain, service sql-visual-explorer
Passwords & API keys (Windows) DPAPI-encrypted files under %APPDATA%\sql-visual-explorer\secrets
Passwords & API keys (Linux) Secret Service via secret-tool (GNOME Keyring, KWallet, …)

Nothing leaves the machine unless you explicitly enable the AI Advisor.

AI Advisor (optional)

Off by default. Open the advisor settings from the gear button next to AI Advisor on the plan toolbar and point it at any OpenAI-compatible endpoint:

Setting Default
Endpoint https://api.openai.com/v1
Model gpt-4o-mini
API key required — stored in the OS keychain

When enabled, the advisor receives the SQL text, the database type, and the list of detected issues, and returns a summary, concrete suggestions, and an optional rewritten query.

Project layout

src/
  SQLVisualExplorer.Desktop        # Avalonia entry point
  SQLVisualExplorer.UI             # views, controls, view models
  SQLVisualExplorer.Application    # service interfaces and use cases
  SQLVisualExplorer.Infrastructure # drivers, plan parsers, persistence, secrets
  SQLVisualExplorer.Domain         # models and enums
tests/
  SQLVisualExplorer.Infrastructure.Tests

Dependencies flow inward: Desktop → UI → Application ← Infrastructure, with Domain at the centre. Adding a database means implementing IDatabaseDriver and IExplainParser — nothing above Infrastructure needs to change.

Built with Avalonia 11, AvaloniaEdit, CommunityToolkit.Mvvm, and EF Core 10.

Development

# build
dotnet build SQLVisualExplorer.sln --no-restore /m:1

# test
DOTNET_ROLL_FORWARD=Major dotnet test SQLVisualExplorer.sln --no-restore /m:1

/m:1 keeps solution builds deterministic in the current local environment. Warnings are errors (TreatWarningsAsErrors), and nullable reference types are enabled solution-wide.

EF Core migrations

Local EF tooling is pinned through dotnet-tools.json.

dotnet tool restore

DOTNET_ROLL_FORWARD=Major dotnet tool run dotnet-ef migrations add <MigrationName> \
  --project src/SQLVisualExplorer.Infrastructure/SQLVisualExplorer.Infrastructure.csproj \
  --startup-project src/SQLVisualExplorer.Infrastructure/SQLVisualExplorer.Infrastructure.csproj \
  --output-dir Database/Migrations

DOTNET_ROLL_FORWARD=Major dotnet tool run dotnet-ef database update \
  --project src/SQLVisualExplorer.Infrastructure/SQLVisualExplorer.Infrastructure.csproj \
  --startup-project src/SQLVisualExplorer.Infrastructure/SQLVisualExplorer.Infrastructure.csproj

Contributing

See CONTRIBUTING.md. Bug reports and feature ideas are welcome via issues.

License

MIT © Komortes

About

Native desktop tool for SQL execution-plan visualization and analysis. Supports PostgreSQL, MySQL, MariaDB, and SQLite.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages