-
Notifications
You must be signed in to change notification settings - Fork 63
Skip live query plans on Azure SQL DB (#857) #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -217,11 +217,18 @@ internal static string BuildQuerySnapshotsQuery(bool supportsLiveQueryPlan, bool | |
| /// </summary> | ||
| private async Task<int> CollectQuerySnapshotsAsync(ServerConnection server, CancellationToken cancellationToken) | ||
| { | ||
| // dm_exec_query_statistics_xml requires SQL Server 2016 SP1+ (version 13) | ||
| /* | ||
| * sys.dm_exec_query_statistics_xml requires SQL Server 2016 SP1+ (version 13) | ||
| * on boxed, and VIEW SERVER PERFORMANCE STATE on Azure SQL Database regardless | ||
| * of tier. DB-scoped logins (e.g. D365FO) don't have the server-level grant | ||
| * and the DMF raises error 300 even when only called for current-DB sessions, | ||
| * so we disable live query plans on Azure SQL DB entirely. See #857. | ||
| */ | ||
| var serverStatus = _serverManager.GetConnectionStatus(server.Id); | ||
| var supportsLiveQueryPlan = serverStatus.SqlMajorVersion >= 13 || serverStatus.SqlMajorVersion == 0 | ||
| || serverStatus.SqlEngineEdition == 5 || serverStatus.SqlEngineEdition == 8; | ||
| var isAzureSqlDatabase = serverStatus.SqlEngineEdition == 5; | ||
| var supportsLiveQueryPlan = !isAzureSqlDatabase | ||
| && (serverStatus.SqlMajorVersion >= 13 || serverStatus.SqlMajorVersion == 0 | ||
| || serverStatus.SqlEngineEdition == 8); | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Behaviour change worth calling out: previously Generated by Claude Code |
||
|
|
||
| var query = BuildQuerySnapshotsQuery(supportsLiveQueryPlan, isAzureSqlDatabase); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gating logic now lives in two places — here and
RemoteCollectorService.QuerySnapshots.cs:231. They agree today (!isAzureSqlDatabase), but the collector also factors version/edition (>= 13 || == 0 || == 8) while this caller only checks Azure. If the collector's predicate gets tighter later (e.g. excludes some other engine edition), this site won't follow. Consider exposing a singleRemoteCollectorService.SupportsLiveQueryPlan(serverStatus)helper so both sites share the rule.Generated by Claude Code