Settings that change query plans
get_optimizer_settingsReports SQL Server settings that affect query compilation—compatibility level, scoped configurations, Query Store, MAXDOP, and trace flags—to diagnose plan changes or server differences.
Instructions
Reports the settings that change how SQL Server compiles queries in one database: the compatibility level and the cardinality estimator it implies, automatic and asynchronous statistics updates, forced parameterization, every database scoped configuration (MAXDOP, LEGACY_CARDINALITY_ESTIMATION, PARAMETER_SNIFFING and the rest) with whether it is the default, the Query Store state, and on the server max degree of parallelism, cost threshold for parallelism and the global trace flags. Use it when a plan changed, or differs between two servers; for one table's statistics use get_table_statistics. A section that cannot be read comes back null, and 'visibility' says why.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"database": "<database>"
},
"name": "get_optimizer_settings"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | Name of the database as registered in the configuration. |