sqlinsight-pro/src/SQLInsight.Rules/BuiltInRules.cs
Claude e4910aeba5
Some checks are pending
CI / Build og unit tests (push) Waiting to run
CI / Integration (mcr.microsoft.com/mssql/server:2017-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2019-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2022-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2025-latest) (push) Blocked by required conditions
Fase 2: Query Store analysis (plan regressions, failed forced plans, parameter sensitivity)
Collector reads the 100 heaviest queries per Query Store database, split
into the last 24 hours and the week before. Rules:
- SQLI-QS-001 plan regression: new plan >= 2x slower than the best plan
  from the week before and >= 60 s extra per day; scripts the force
- SQLI-QS-002 forced plan that fails (e.g. NO_INDEX); scripts the unforce
- SQLI-QS-003 parameter sensitivity: very different plans or volatile
  durations; suggests PSP optimization / Query Store hints on 2022+
Also: backups taken in the same second a database was created count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E3EExwndy8Z22EK2Qpt6BK
2026-09-29 07:33:14 +00:00

56 lines
1.6 KiB
C#

using SQLInsight.Rules.Concurrency;
using SQLInsight.Rules.Configuration;
using SQLInsight.Rules.Databases;
using SQLInsight.Rules.Engine;
using SQLInsight.Rules.Lifecycle;
using SQLInsight.Rules.Performance;
namespace SQLInsight.Rules;
public static class BuiltInRules
{
public static IReadOnlyList<IRule> Create() =>
[
// Version
new SupportLifecycleRule(SupportLifecycleCatalog.LoadEmbedded()),
new PatchLevelRule(BuildCatalog.LoadEmbedded(), SupportLifecycleCatalog.LoadEmbedded()),
// Configuration
new MaxServerMemoryDefaultRule(),
new MaxServerMemoryTooHighRule(),
new CostThresholdRule(),
new MaxDopRule(),
new OptimizeForAdHocRule(),
.. SimpleConfigurationRules.Create(),
new PendingConfigurationRule(),
new DeadlockTraceFlagRule(),
// Databases
new DatabaseStateRule(),
.. SimpleDatabaseRules.Create(),
new CompatibilityLevelRule(),
new FullBackupRule(),
new LogBackupRule(),
new CheckDbRule(),
new SuspectPagesRule(),
new VirtualLogFileRule(),
new FileGrowthRule(),
new FileMaxSizeRule(),
new QueryStoreStateRule(),
new TempdbFilesRule(),
// Performance
.. WaitRules.Create(),
new DataFileReadLatencyRule(),
new LogFileWriteLatencyRule(),
new CpuRule(),
new MemoryGrantsPendingRule(),
new PlanRegressionRule(),
new FailedForcedPlanRule(),
new ParameterSensitivityRule(),
// Concurrency
new BlockingRule(),
new DeadlockRule(),
];
}