Skip to content

Commit 76eca9c

Browse files
Rule 9: Raise memory grant warning floor to 1GB, Critical to 4GB
No memory grant warnings should fire below 1GB on modern hardware. Excessive grant (9a) and large grant (9c) both now require >= 1GB. Critical severity raised from 512MB to 4GB. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 608c1fd commit 76eca9c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Dashboard/Services/PlanAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static void AnalyzeStatement(PlanStatement stmt)
7575
if (grant.GrantedMemoryKB > 0 && grant.MaxUsedMemoryKB > 0)
7676
{
7777
var wasteRatio = (double)grant.GrantedMemoryKB / grant.MaxUsedMemoryKB;
78-
if (wasteRatio >= 10 && grant.GrantedMemoryKB > 1024)
78+
if (wasteRatio >= 10 && grant.GrantedMemoryKB >= 1048576)
7979
{
8080
stmt.PlanWarnings.Add(new PlanWarning
8181
{
@@ -98,7 +98,7 @@ private static void AnalyzeStatement(PlanStatement stmt)
9898
}
9999

100100
// Large memory grant with sort/hash guidance
101-
if (grant.GrantedMemoryKB > 102400 && stmt.RootNode != null)
101+
if (grant.GrantedMemoryKB >= 1048576 && stmt.RootNode != null)
102102
{
103103
var consumers = new List<string>();
104104
FindMemoryConsumers(stmt.RootNode, consumers);
@@ -112,7 +112,7 @@ private static void AnalyzeStatement(PlanStatement stmt)
112112
{
113113
WarningType = "Large Memory Grant",
114114
Message = $"Query granted {grantMB:F0} MB of memory.{guidance}",
115-
Severity = grantMB >= 512 ? PlanWarningSeverity.Critical : PlanWarningSeverity.Warning
115+
Severity = grantMB >= 4096 ? PlanWarningSeverity.Critical : PlanWarningSeverity.Warning
116116
});
117117
}
118118
}

Lite/Services/PlanAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static void AnalyzeStatement(PlanStatement stmt)
7575
if (grant.GrantedMemoryKB > 0 && grant.MaxUsedMemoryKB > 0)
7676
{
7777
var wasteRatio = (double)grant.GrantedMemoryKB / grant.MaxUsedMemoryKB;
78-
if (wasteRatio >= 10 && grant.GrantedMemoryKB > 1024)
78+
if (wasteRatio >= 10 && grant.GrantedMemoryKB >= 1048576)
7979
{
8080
stmt.PlanWarnings.Add(new PlanWarning
8181
{
@@ -98,7 +98,7 @@ private static void AnalyzeStatement(PlanStatement stmt)
9898
}
9999

100100
// Large memory grant with sort/hash guidance
101-
if (grant.GrantedMemoryKB > 102400 && stmt.RootNode != null)
101+
if (grant.GrantedMemoryKB >= 1048576 && stmt.RootNode != null)
102102
{
103103
var consumers = new List<string>();
104104
FindMemoryConsumers(stmt.RootNode, consumers);
@@ -112,7 +112,7 @@ private static void AnalyzeStatement(PlanStatement stmt)
112112
{
113113
WarningType = "Large Memory Grant",
114114
Message = $"Query granted {grantMB:F0} MB of memory.{guidance}",
115-
Severity = grantMB >= 512 ? PlanWarningSeverity.Critical : PlanWarningSeverity.Warning
115+
Severity = grantMB >= 4096 ? PlanWarningSeverity.Critical : PlanWarningSeverity.Warning
116116
});
117117
}
118118
}

0 commit comments

Comments
 (0)