● Сообщество
erikdarlingdata
⚡ Сразу
PerformanceMonitor
автор erikdarlingdata · erikdarlingdata/PerformanceMonitor
Ask 'why is SQL Server slow?' and get wait stats, blocking chains, and plan analysis in plain English via Erik Darling's MCP.
PerformanceMonitor is Erik Darling's free SQL Server monitoring app with an embedded MCP server. It exposes 50+ read-only diagnostic tools (wait stats, blocking, deadlocks, plan analyzer, tempdb, memory) over localhost HTTP, letting an AI agent do the first-pass triage on a slow or stuck server.
Зачем использовать
Ключевые функции
- 50+ diagnostic tools across CPU, memory, waits, blocking, deadlocks, file I/O, plans
- Built-in 30-rule PlanAnalyzer for surfacing common query anti-patterns
- Localhost-only HTTP binding — never exposed on the network
- Works against SQL Server 2016-2025, Azure SQL, and AWS RDS
- Read-only diagnostics — cannot modify data, schema, or server config
Живое демо
Как выглядит на практике
performancemonitor.replay
▶ готово
Сценарии использования
Реальные сценарии: PerformanceMonitor
Когда использовать: Users are reporting timeouts and you need to know what's blocking whom in the next 60 seconds.
Предварительные требования
- PerformanceMonitor app installed and connected to target server — Download from the GitHub releases and point it at your monitoring DB
- Target login has VIEW SERVER STATE — GRANT VIEW SERVER STATE TO [monitor_login]
- MCP registered with your client — claude mcp add --transport http --scope user sql-monitor http://localhost:5151/
Поток
-
Get the health overview
Run the health check — any red flags on waits, blocking, or memory pressure right now?✓ Скопировано
→ Short list of elevated metrics
-
Drill into the top offender
If blocking is the top issue, show me the head blocker chain and the SQL text of the blocking session.✓ Скопировано
→ Specific SPID + query text
-
Get a recommendation
Should I kill that SPID, wait it out, or is there a missing index that would prevent this? Be specific.✓ Скопировано
→ One clear recommended action with rationale
Итог: A diagnosed incident with a specific next action — kill, wait, index, or escalate — in under 5 minutes.
Подводные камни
- Killing a blocker that was about to commit can cause more damage — Always ask for how long it's been running and whether it holds an open transaction before killing
- Metrics from the monitoring DB lag the real server by the collector interval — For live view, use the 'current state' tools rather than aggregated history
Когда использовать: A query is slow and the plan is 200 operators — you don't want to read it manually.
Поток
-
Fetch the plan
Get the most recent plan for query hash 0xA1B2C3 and run the PlanAnalyzer against it.✓ Скопировано
→ Plan + list of rule hits
-
Explain the worst rule hit
Explain the #1 rule hit in plain English — what's happening and why it's bad.✓ Скопировано
→ 2-3 sentence explanation in English, not jargon
-
Suggest a fix
Suggest the smallest change to fix it: index, rewrite, or stats update. Estimate impact.✓ Скопировано
→ Concrete DDL or rewrite
Итог: A specific tuning action backed by both plan evidence and the PlanAnalyzer rule.
Подводные камни
- Plan was cached under a different parameter sniffing path — Regenerate the plan with OPTION(RECOMPILE) before trusting its shape
Когда использовать: Friday afternoon wrap-up; know before users tell you.
Поток
-
Pull week-over-week stats
Compare top waits and top queries this week vs last week. Flag anything that got materially worse.✓ Скопировано
→ Deltas with percentages
-
Draft a team-readable summary
Write a one-page health summary — good/bad/ugly — for the engineering channel.✓ Скопировано
→ Markdown post ready to paste
Итог: A shareable weekly health post with concrete items to track next week.
Комбинации
Сочетайте с другими MCP — эффект x10
Sentry flags a timeout spike; cross-reference with SQL Server blocking at the same timestamp
Sentry event at 14:03 UTC shows SqlException. What was happening on the DB between 14:02 and 14:04 — any blocking or waits spikes?✓ Скопировано
Find the commit that introduced a slow query
Query hash 0xA1B2 started showing up in the top 10 on 2026-03-22. Find GitHub commits to the data-access layer around that date.✓ Скопировано
Стоимость и лимиты
Во что обходится
- Квота API
- No external quota; bounded by your monitoring DB capacity
- Токенов на вызов
- Most tools return 200-2000 tokens; plan XML can be 10k+
- Деньги
- Free, open-source (Lite and Full editions)
- Совет
- Lite edition is enough for most single-instance shops. Full adds cross-server monitoring.
Безопасность
Права, секреты, радиус поражения
Минимальные скоупы: VIEW SERVER STATE on the target instance
Хранение учётных данных: Monitoring DB connection string managed in the app's settings — stays on your box
Исходящий трафик: MCP binds to localhost only; no outbound calls from the MCP process
Никогда не давайте: sysadmin or db_owner — VIEW SERVER STATE is enough
- Plan XML and query text may contain sensitive data — be careful pasting into shared chat logs.
- Run the collector under a dedicated login, not your personal account.
Устранение неполадок
Частые ошибки и исправления
Cannot connect to http://localhost:5151/
The app isn't running or MCP is disabled in Settings. Open the app, enable MCP, and confirm the port.
Проверить: curl http://localhost:5151/
Login failed for user
Monitoring DB credentials are wrong. Re-enter in the app and confirm VIEW SERVER STATE.
Проверить: sqlcmd -S <server> -U <user> -P <pwd> -Q 'SELECT 1'
Plan analyzer returns no findings on clearly slow query
Plan may not be in cache. Re-run the query with OPTION(RECOMPILE) and try again.
Проверить: SELECT plan_handle FROM sys.dm_exec_query_stats WHERE ...
Port 5151 already in use
Change the MCP port in Settings (range 1024-65535) and re-register with your client.
Проверить: netstat -an | grep 5151
Альтернативы
PerformanceMonitor в сравнении
| Альтернатива | Когда использовать | Компромисс |
| sp_BlitzFirst / Brent Ozar scripts | You prefer running T-SQL procs directly without an app | No MCP — you paste output into the chat yourself |
| SentryOne / Redgate SQL Monitor | Enterprise environments that already have a commercial monitor | Paid; most don't expose an MCP surface |
| postgres MCP | You're on Postgres, not SQL Server | Different DB entirely |