Initial commit: local SQL expert AI (Ollama + CLI + prompts + systemd timer)

This commit is contained in:
2026-01-27 21:30:15 +01:00
commit 394edc1709
18 changed files with 574 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
# Parameter Sniffing & Statistics Playbook
## Symptome
- Laufzeit stark schwankend je nach Parameter
- Plan ist "gut" für einen Wert, "schlecht" für andere
- Große Estimated vs Actual Abweichungen
- Memory grants/spills je nach Parameter
## Diagnose (ohne DB-Zugriff: theoretisch/plan-basiert)
- Welche Prädikate sind parameterabhängig?
- Gibt es Skew (ein Wert sehr häufig/selten)?
- OR-Logik / optional filters (@p IS NULL OR col=@p)?
- Implizite Konvertierungen?
## Gegenmaßnahmen (geordnet von "leicht" zu "hart")
1) Query rewrite (SARGability, Splitting optional filters)
2) OPTION(RECOMPILE) selektiv
3) OPTIMIZE FOR (oder OPTIMIZE FOR UNKNOWN) bewusst
4) Zwei Queries / IF branches für stark unterschiedliche Pfade
5) Plan guides / forced plan (nur in Ausnahmefällen)
6) Stats: update + ggf. filtered stats (wenn passend)
## Checkliste
- Welche Parameter-Sets testen (min/max/typisch)
- Regression: CPU/Reads/Duration
- Concurrency/Blocking beachten
---BEGIN INPUT---
<PASTE HERE>
---END INPUT---