SQL performance tuning for SQL Server · PostgreSQL · MySQL · MariaDB

Find the slow query that's
dragging your database down.

Culprit reads the statistics your database already keeps and tells you, in one sentence, what's slow, what it costs and how to fix it.

Read-onlyNothing leaves your machineFree, MIT licensedmacOS · Windows · Linux

Culprit SQL Studio dashboard for a SQL Server database: database time over five hours with a plan change on its timeline, findings ranked by severity, top queries, wait statistics and a blocked session

What a slow-query diagnosis looks like

High

A read from order_items times out on every run, at about 15 s.

Why
Its plan repeats a read of order_items 1.5M times, once per row: the query forces a loop join, where one hash join over a single pass would do.
Fix
Remove OPTION (LOOP JOIN) and let the optimizer choose.
Verify
Run it with actual rows: a hash join, and far fewer executions of order_items.
  • 50checks for what costs time
  • 25MCP tools for coding agents
  • 0 bytesleave your machine
  • <1 sto open; 10 ms per CLI call

Findings

Slow queries and missing indexes, ranked by what they cost.

Runaway loops in plans, plan regressions, parameter sniffing, missing and unused indexes, N+1 query storms, lock pile-ups, implicit conversions that block index seeks, spills to disk and stale statistics. Each finding comes with the evidence, a production-safe fix and how to verify it.

A finding: a query repeats its read of order_items 1.5 million times because it forces a loop join, with its share of database time, the evidence, the plan's key step, the fix and how to verify it

Plans

Execution plans that explain themselves.

Insights in plain words, a diagram that shows where the cost goes, and every operator's details one click away. Compare any two plans, from SSMS, EXPLAIN or MySQL, and the headline says why one is slower.

Two PostgreSQL execution plans compared: plan 13 is estimated 3.5 thousand times more expensive because it scans orders where plan 12 seeks an index, with the six changed steps

What changed

Query regressions: drag across a chart, get the why.

Compare two periods and Culprit lists what got slower, what's new and what improved, next to the deploys and statistics updates around them: "Got 293× slower at 5:00 PM, when SQL Server switched from plan 163 to plan 198."

What changed between two periods: one query got 293 times slower after a plan switch, seven new queries, and the deploy and statistics update around them

Live

Blocking and deadlocks: who is blocking whom, right now.

A wall of lock waits becomes one sentence and a tree: which session holds everyone up, why, and who waits behind it. Deadlocks get the same treatment, with the pattern named and the fix spelled out.

A blocking tree: session 71 has been idle in an open transaction for 22 seconds and two sessions wait behind it

Why Culprit

An expert's afternoon of performance tuning, done in seconds.

Answers, not raw numbers

Every finding is ranked by its share of database time and comes with the evidence, a fix that's safe on production and a way to prove it worked.

Fast and light

A 14 MB native app that opens in under a second and shows the last report at once while a fresh scan runs in the background. Nothing to install on the server.

Open and pluggable

MIT licensed. Add your own checks or database engines without forking: the app, the CLI and the agent tools share one Rust core.

Built for coding agents

An MCP server for database performance. You stay in control.

culprit mcp gives Claude Code, Codex and Cursor 25 tools: the dashboard, findings, execution plans and their insights, what changed, blocking, waits, index advice and verify. Every CLI command speaks JSON too.

  • Per-connection access. Off, statistics and plans (the default), or read-only queries you approve one by one.
  • Approve the exact statement. You see the SQL and what Culprit guarantees: one read-only statement, rolled back, capped in rows and time.
  • Everything audited. Every tool call lands in a local log you can read with culprit audit.
An approval dialog: claude-code wants to run a SELECT on a development connection; checked as read-only, rolled back, capped at 200 rows and 30 seconds; Deny or Run once
$ claude mcp add culprit -- culprit mcp
$ culprit agent init   # set up this repo's agents
> the order report keeps timing out on staging. why?
● culprit.dashboard staging
● culprit.findings staging · severity ≥ medium
● culprit.plan_insights query 263
It times out on every run (about 15 s, 27% of database time): its plan repeats a read of order_items 1.5M times because the query forces a loop join. Removing OPTION (LOOP JOIN) lets SQL Server hash-join once.

Safe on production

Read-only by design. Careful by default.

Reads statistics only

Scans use catalog and statistics views with short lock timeouts. Estimated plans never run anything.

Production asks first

If Culprit can prove a statement only reads, it runs it read-only. Anything else on production asks you first.

Fixes are suggestions

Every fix is shown and copied, never applied, and uses online or concurrent operations where the server has them.

Your data stays yours

No account, no cloud, no telemetry. Passwords live in your OS keychain; Entra ID uses your az login.

Supported databases

SQL Server, PostgreSQL, MySQL and MariaDB. One tool.

SQL Server and Azure SQL

Query Store, the plan cache, DMVs, wait statistics and the deadlock history in Extended Events.

PostgreSQL and Amazon RDS

Versions 15 to 18: pg_stat_statements, the statistics views and EXPLAIN, generic plans included.

MySQL

Versions 5.7 to 8.4: performance_schema, sys and EXPLAIN FORMAT=JSON.

MariaDB

Versions 10.5 to 11.8: performance_schema, the slow query log and ANALYZE FORMAT=JSON.

Download

Download Culprit SQL Studio for macOS, Windows and Linux.

Free and open source under the MIT license.

macOS

Apple silicon and Intel · macOS 11+
Signed and notarized by Apple

Download .dmg

Windows

Windows 10 and 11 · x64
Not code-signed yet: SmartScreen may ask once

Download installer

Just the CLI

One binary for scripts, CI and agents. Download it for macOS, Linux or Windows, then:

$ culprit conn add shop --url 'postgres://app@db.example.com:5432/shop'
$ culprit dashboard shop    # the database at a glance

All releases and checksums: github.com/cristipufu/culprit-sql-studio/releases

Frequently asked questions

What permissions does Culprit need?

Read access to the server's statistics. SQL Server needs VIEW SERVER STATE (VIEW DATABASE STATE on Azure SQL Database). PostgreSQL needs pg_read_all_stats or pg_monitor. MySQL and MariaDB need PROCESS and SELECT on performance_schema. When a check can't run with your login, Culprit names the exact grant that unlocks it.

Do I need to install anything on the database server?

No. There's no agent or collector: Culprit connects like any client and reads the statistics the database already keeps (Query Store, pg_stat_statements, performance_schema). If one of them is switched off, it shows the one statement that turns it on.

Will it change anything in my database?

No. Scans only read statistics and catalog views. The SQL editor runs reads read-only, and anything that could change data on a production connection asks you first. Suggested fixes are shown, never applied.

Is it a monitoring tool?

It's an investigation tool: open it when something is slow, or let your coding agent ask it. History comes from Query Store and from Culprit's own saved scans, so there's no server to run and nothing collecting around the clock.

Does it work with Azure SQL and Amazon RDS?

Yes. Azure SQL Database and Amazon RDS for PostgreSQL are tested, Entra ID sign-in uses your az login, and Culprit can find your Azure and AWS databases with your existing CLI login.

How is it different from the SSMS Query Store reports or pgAdmin?

Those show the numbers. Culprit reads them for you: it ranks what costs the most time, explains it in one sentence, gives the fix and tells you how to verify it, with the same views on all four engines.

Which coding agents work with it?

Any agent that speaks the Model Context Protocol, including Claude Code, Codex and Cursor. Agents can also call the CLI directly, since every command has JSON output.

Is it really free?

Yes. Culprit SQL Studio is open source under the MIT license: the app, the CLI and the MCP server.

Your slow query has a name. Find it in a minute.

Download Culprit SQL Studio