Files
jr-sql-ai/prompts/tsql_review.md

30 lines
1.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# T-SQL Review Template (Copy & Paste)
> Zweck: schnelle, präzise Analyse einer Abfrage.
> Eingabe: T-SQL + (optional) Parameterwerte + (optional) Tabelleninfos.
## Kontext (optional)
- SQL Server Version: 2022
- DB Kompatibilitätslevel: ?
- Tabellenvolumen grob (Rows): ?
- Häufigkeit/Latency Ziel: ?
- Parameterwerte (typisch & worst-case): ?
## Aufgabe
Analysiere das T-SQL und liefere:
1) **Kurzfazit** (36 Bulletpoints)
2) **Detailanalyse**:
- SARGability (LIKE, Funktionen auf Spalten, CAST/CONVERT, Datentyp-Mismatches)
- Joins/Predicates (Reihenfolge, Join Typen)
- Kardinalität/Stats (wo schätzt der Optimizer falsch)
- Parameter Sniffing Risiko + konkrete Mitigation (z.B. OPTION(RECOMPILE) gezielt, OPTIMIZE FOR, plan guides nur wenn nötig)
3) **Konkrete Verbesserungen**:
- rewrite (mit kommentiertem SQL)
- Index-Vorschläge (nur wenn plausibel; include columns; Filtered Index falls geeignet)
4) **Checks**:
- welche Messwerte/Plan-Indikatoren prüfen
---BEGIN T-SQL---
<PASTE HERE>
---END T-SQL---