Analyzes and optimizes slow queries on Fabric Data Warehouse by capturing execution plans, inspecting statistics, and suggesting clustering or indexing fixes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fabric-dw:query-optimizerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyzes and optimizes a query on a Fabric Data Warehouse using the fabric-dw MCP tools.
Analyzes and optimizes a query on a Fabric Data Warehouse using the fabric-dw MCP tools.
Gather these from the user (via $ARGUMENTS or natural language) before starting:
If the warehouse is a SQL Analytics Endpoint, skip steps 8, 9, 11 (clustering), and 13 (set_cluster_columns).
Call get_query_plan with the query text. This returns a SHOWPLAN_XML document without executing the query.
To visualize the plan, use the CLI (pass the warehouse name as the first argument and the query via -q):
fdw sql plan <warehouse> -q "<query>" --format html -o plan.html # writes self-contained HTML; open plan.html in any browser
fdw sql plan <workspace>/<warehouse> -q "<query>" --format svg -o plan.svg # renders SVG via system dot binary (requires Graphviz)
Note: --format html requires -o/--output; it writes a file and does not open the browser automatically.
Analyze the returned SHOWPLAN_XML for:
CONVERT_IMPLICIT on a column used in a predicateUse list_request_history (filter by SQL text substring if supported) and list_long_running_queries to see whether this query pattern has a history of slow executions. Note elapsed time and status.
For every table referenced in the query, call list_statistics to enumerate existing statistics objects. Note which columns lack statistics.
For any statistic that appears potentially stale or absent, call show_statistics to examine its header (last_updated timestamp, row count, rows sampled) and histogram. Flag statistics whose sample rate or update date suggests staleness. This is heuristic; flag rather than assert.
For each table referenced in the query, call get_table_columns to retrieve: column name, formatted data type (e.g. VARCHAR(50), DECIMAL(18,2)), nullable flag, identity flag, computed flag.
Use column types and nullable flags to identify:
Call get_cluster_columns for each table (skip for SQL Analytics Endpoints). Returns the ordered list of CLUSTER BY columns, or an empty list if no clustering is defined.
Compare current clustering columns (and their data types from step 6) against the WHERE predicates, JOIN keys, and aggregation patterns in the query plan. A good clustering candidate:
Note whether a table lacks clustering entirely but would benefit from it.
Summarize all findings in a structured report:
For each finding, propose a concrete action:
Before calling any statistics tool, ask the user explicitly: "Should I apply the statistics changes now?" The MCP server enforces its own write-guard (controlled by
FABRIC_MCP_ALLOW_WRITES/FABRIC_MCP_ALLOW_DESTRUCTIVEserver config), but it does not pop a user dialog. The agent must ask before proceeding.
If the user confirms, apply statistics changes using create_statistics (for absent stats) or update_statistics (for stale stats). For large tables, prefer update_statistics with a SAMPLE percentage rather than FULLSCAN to limit execution time.
Before calling
set_cluster_columns, ask the user explicitly and surface the following: "set_cluster_columnsperforms a full transactional CTAS-swap, a complete physical copy of the table. This may take significant time on large tables, the table will be briefly unavailable during the swap, and dependent views or stored procedures may need refreshing afterwards. Should I proceed?" Only call the tool after the user explicitly acknowledges and approves.
If the user confirms and acknowledges, call set_cluster_columns with the recommended clustering columns.
get_query_plan obtains the plan without executionnpx claudepluginhub sdebruyn/fabric-dw-mcp-cli --plugin fabric-dwMines projects and conversations into a searchable memory palace. Activates on queries about MemPalace, memory palace, mining, searching, palace setup, wings, rooms, drawers, or recalling past work.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
2plugins reuse this skill
First indexed Jun 27, 2026