Skip to main content
Glama

get_query_plan

Analyze SQL SELECT query performance by generating estimated or actual XML execution plans. Identify optimization opportunities and understand query execution behavior.

Instructions

Get the estimated or actual XML execution plan for a SELECT query. Estimated plans show the optimizer's plan without executing. Actual plans execute the query and include runtime statistics. Uses the same query validation as read_data (SELECT only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverNameYesName of the SQL Server to query (use list_servers to see available names)
queryYesSQL SELECT query to get the execution plan for. Only SELECT and WITH (CTE) queries are permitted.
databaseNameYesName of the database to query (use list_databases to see available databases)
outputPathYesFile path for output (e.g. '/tmp/plan.sqlplan')
planTypeNoPlan type: 'estimated' (default, does not execute) or 'actual' (executes the query)estimated

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mbentham/sql-augur'

If you have feedback or need assistance with the MCP directory API, please join our Discord server