From fabric-skills
Diagnoses SQL database in Fabric performance via sqlcmd against Query Store, DMVs, and Extended Events. Identifies top resource-consuming queries, blocking chains, missing indexes, and plan regressions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fabric-skills:sqldb-operations-cliThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **Update Check — ONCE PER SESSION (mandatory)**
Update Check — ONCE PER SESSION (mandatory) The first time this skill is used in a session, run the check-updates skill before proceeding.
- GitHub Copilot CLI / VS Code: invoke the
check-updatesskill.- Claude Code / Cowork / Cursor / Windsurf / Codex: compare local vs remote package.json version.
- Skip if the check was already performed earlier in this session.
CRITICAL NOTES
- To find the workspace details (including its ID) from workspace name: list all workspaces and, then, use JMESPath filtering
- To find the item details (including its ID) from workspace ID, item type, and item name: list all items of that type in that workspace and, then, use JMESPath filtering
Deep performance diagnostics for SQL database in Fabric via sqlcmd against Query Store, DMVs, sys.dm_db_resource_stats, and Extended Events. All analytical queries are read-only; the optional XE session creation is dropped at the end of the investigation.
VIEW DATABASE STATE for DMVs; ALTER ANY EVENT SESSION to create XE sessions.| Topic | Reference |
|---|---|
| Finding Workspaces and Items in Fabric | COMMON-CLI.md § Finding Workspaces and Items in Fabric — read first |
| SQL / TDS Data-Plane Access (sqlcmd, auth) | COMMON-CLI.md § SQL / TDS Data-Plane Access |
| CLI Gotchas (audience, escaping, expiry) | COMMON-CLI.md § Gotchas & Troubleshooting |
| Endpoint Selection (use OLTP) | SQLDB-CONSUMPTION-CORE.md § Endpoint Selection |
| Performance and Monitoring foundations | SQLDB-CONSUMPTION-CORE.md § Performance and Monitoring |
| Limitations Reference (unsupported features, DMVs) | SQLDB-AUTHORING-CORE.md § Limitations Reference |
| Mirroring Considerations | SQLDB-AUTHORING-CORE.md § Mirroring Considerations |
| All diagnostic T-SQL | references/query-reference.md |
| Investigation Workflows | SKILL.md § Investigation Workflows |
| Examples | references/examples.md |
For Fabric topology, capacity, and platform auth basics see COMMON-CORE.md.
Diagnostics run against the SQL database (OLTP) endpoint. For endpoint discovery, authentication, and sqlcmd connection guidance, use the shared CLI instructions in COMMON-CLI.md rather than inline setup here.
Once connected, use the diagnostic workflows below and the full T-SQL catalog in query-reference.md.
All SQL is in query-reference.md. Step-by-step orchestration in Investigation Workflows below.
sys.sp_query_store_force_plan is supported but use sparingly; auto-tuning may correct over time.avg_cpu_percent ≥ 80 over 10 min = sustained; non_cpu_to_cpu_ratio > 5 = waiting on resources, not CPU-bound.avg_data_io_percent ≥ 80 (data); avg_log_write_percent ≥ 80 (log, often un-batched DML).sys.dm_db_resource_stats retains only 1 hour of 15-second samples; persist or use Query Store for longer windows.Optimized locking is on by default — no traditional lock escalation. Most blocking comes from long-running transactions, app-side held transactions, or hot-row contention.
open_transaction_count > 0 → application is holding an open transaction; fix client code.ON DATABASE only (not ON SERVER); use ring_buffer target. Always clean up.index_advantage = user_seeks * avg_total_user_cost * (avg_user_impact * 0.01). DMV stats reset on restart.≥ 100,000 rows and ≥ 10% modification.Step-by-step orchestration. Each step links to the corresponding query in query-reference.md.
open_transaction_count, SQL text, program_name.open_transaction_count > 0 → application bug; fix client code (uncommitted transaction).Full list of unsupported features: SQLDB-AUTHORING-CORE.md § Limitations Reference. Operations-critical items:
| Do NOT Recommend | Why | Recommend Instead |
|---|---|---|
Server-scoped DMVs (sys.dm_os_*, sys.configurations) | Not exposed | sys.dm_db_resource_stats, Query Store views |
EXECUTE AS for security testing | Not supported | Connect as the actual user identity |
CREATE EVENT SESSION ... ON SERVER, file-target XE | Database-scoped only | ... ON DATABASE with ring_buffer target |
Trace flags / DBCC TRACEON | Not supported | Re-architect query or use Query Store hints |
| Manual lock escalation tuning | Optimized locking eliminates escalation | Address root cause (long transactions, hot rows) |
| SQL analytics endpoint for diagnostics | DMVs/Query Store don't exist there | Connect to the SQL database (OLTP) endpoint |
Aggressive sp_query_store_force_plan | Masks root cause | Fix stats / parameter sniffing first; force only as a stop-gap |
For consumption foundations see SQLDB-CONSUMPTION-CORE.md § Performance and Monitoring.
DATEADD lookback windows to the user's investigation scope.sys.dm_db_resource_stats if you need > 1 hour of history.CLI/auth issues: COMMON-CLI.md § Gotchas. Platform issues: SQLDB-CONSUMPTION-CORE.md § Gotchas.
-i file.sql for the XE session creation block (here-doc has portability quirks).SET NOCOUNT ON; at the top of multi-statement scripts to keep CSV output clean.sp_query_store_force_plan instead of fixing root cause.| Symptom | Cause | Fix |
|---|---|---|
Invalid object name 'sys.query_store_*' | Querying analytics endpoint | Connect to OLTP endpoint |
| Volatile detection returns no rows | Lookback too short / no recent activity | Expand DATEADD(MINUTE, -60, ...) to -1440 |
sys.dm_db_resource_stats empty | Lookback exceeds 1-hour retention | Reduce window; or use Query Store |
| Permission error on DMVs | Missing VIEW DATABASE STATE | GRANT VIEW DATABASE STATE TO [[email protected]] |
Permission error on CREATE EVENT SESSION | Missing ALTER ANY EVENT SESSION | GRANT ALTER ANY EVENT SESSION TO [[email protected]] |
| XE session captures nothing | LIKE filter too narrow / session in STOP state | Check sys.dm_xe_database_sessions.state; widen filter |
| Multi-plan query has no obvious bad plan | Parameter sniffing | OPTION (RECOMPILE) or OPTIMIZE FOR hint |
See references/examples.md for full prompt/response patterns covering:
npx claudepluginhub microsoft/skills-for-fabric --plugin fabric-skillsQuery SQL database in Fabric via sqlcmd: interactive exploration, vector similarity, JSON, temporal queries, and security policy inspection on OLTP and SQL analytics endpoints (read-only).
Optimizes Azure SQL Database performance via service tier comparisons, DTU/vCore guidance, automatic tuning, Hyperscale/serverless options, and monitoring queries.
Expert guidance for Azure SQL Database covering troubleshooting, architecture, security, deployment, and best practices. Use when choosing tiers, configuring geo-replication, or automating Azure SQL tasks.