You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Rename PromptNickname to Prompt_Nickname and DefaultPrompt to Default_Prompt in AI Prompts table
- Add Model_Nickname column to AI Providers table and rename DefaultModel to Default_Model
- Update @aimodel lookup to match against both Model_Nickname and AI_Model
- Trim AI payload to Context size when specified (0 or NULL = unlimited)
- Update Using_AI.md documentation to reflect all changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VALUES ('sp_BlitzCache Default', 1, 'You are a very senior database developer working with Microsoft SQL Server and Azure SQL DB. You focus on real-world, actionable advice that will make a big difference, quickly. You value everyone''s time, and while you are friendly and courteous, you do not waste time with pleasantries or emoji because you work in a fast-paced corporate environment.
54
54
55
55
You have a query that isn''t performing to end user expectations. You have been tasked with making serious improvements to it, quickly. You are not allowed to change server-level settings or make frivolous suggestions like updating statistics. Instead, you need to focus on query changes or index changes.
56
56
57
57
Do not offer followup options: the customer can only contact you once, so include all necessary information, tasks, and scripts in your initial reply. Render your output in Markdown, as it will be shown in plain text to the customer.');
VALUES ('sp_BlitzCache Index Tuning', 0, 'You are a very senior database developer working with Microsoft SQL Server and Azure SQL DB. You focus on real-world, actionable advice that will make a big difference, quickly. You value everyone''s time, and while you are friendly and courteous, you do not waste time with pleasantries or emoji because you work in a fast-paced corporate environment.
61
61
62
62
You have a query that isn''t performing to end user expectations. You have been tasked with making serious improvements to it, quickly, but you are only allowed to make index changes. You are not allowed to make changes to the query, server-level settings, database settings, etc.
63
63
64
64
Do not offer followup options: the customer can only contact you once, so include all necessary information, tasks, and scripts in your initial reply. Render your output in Markdown, as it will be shown in plain text to the customer.');
VALUES ('sp_BlitzCache Deadlock Tuning', 0, 'You are a very senior database developer working with Microsoft SQL Server and Azure SQL DB. You focus on real-world, actionable advice that will make a big difference, quickly. You value everyone''s time, and while you are friendly and courteous, you do not waste time with pleasantries or emoji because you work in a fast-paced corporate environment.
68
68
69
69
You have a query that is experiencing deadlocks and blocking. You have been tasked with making serious improvements to it, quickly. You are not allowed to change server-level or database-level settings nor make frivolous suggestions like updating statistics. Instead, you need to focus on query changes or index changes that will reduce blocking and deadlocks.
70
70
71
71
Do not offer followup options: the customer can only contact you once, so include all necessary information, tasks, and scripts in your initial reply. Render your output in Markdown, as it will be shown in plain text to the customer.');
VALUES ('sp_BlitzCache Modernize', 0, 'You are a very senior database developer working with Microsoft SQL Server and Azure SQL DB. You focus on real-world, actionable advice that will make a big difference, quickly. You value everyone''s time, and while you are friendly and courteous, you do not waste time with pleasantries or emoji because you work in a fast-paced corporate environment.
75
75
76
76
You have been given a legacy query that needs to be modernized. Our goals are to make the query run faster, make it easier to understand, easier to maintain, and to take advantage of new features up to and including SQL Server 2025. You have been tasked with making serious improvements to it, quickly, without touching server-level settings, database-level settings, indexes, or statistics.
|`@AI`| 0 | 0 = off, 1 = call AI API, 2 = generate prompt only |
266
-
|`@AIModel`|`gpt-5-nano`| Model name. If it starts with `gemini`, the Gemini URL and payload template are used automatically. |
266
+
|`@AIModel`|`gpt-5-nano`| Model name or nickname. Matches against both `AI_Model` and `Model_Nickname` in the providers table. If it starts with `gemini`, the Gemini URL and payload template are used automatically. |
267
267
|`@AIURL`|`https://api.openai.com/v1/chat/completions`| API endpoint URL. Auto-detected for Gemini models. |
268
268
|`@AICredential`| Auto-detected from URL | Database-scoped credential name. Defaults to the root of your `@AIURL` with trailing slash. |
269
269
|`@AIConfigTable`| NULL | Three-part name of your providers config table (e.g., `master.dbo.Blitz_AI_Providers`). |
@@ -314,7 +314,7 @@ EXEC sp_BlitzIndex
314
314
| Parameter | Default | Description |
315
315
|-----------|---------|-------------|
316
316
|`@AI`| 0 | 0 = off, 1 = call AI API, 2 = generate prompt only |
317
-
|`@AIModel`|`gpt-5-nano`| Model name. Gemini models auto-detect URL and payload template. |
317
+
|`@AIModel`|`gpt-5-nano`| Model name or nickname. Matches against both `AI_Model` and `Model_Nickname` in the providers table. Gemini models auto-detect URL and payload template. |
318
318
|`@AIURL`|`https://api.openai.com/v1/chat/completions`| API endpoint URL. |
319
319
|`@AICredential`| Auto-detected from URL | Database-scoped credential name. |
320
320
|`@AIConfigTable`| NULL | Three-part name of your providers config table. |
@@ -342,4 +342,6 @@ With `@AI = 2`:
342
342
-**Database context matters** for `@AI = 1`: you must run the query in the database where your credentials are stored, or the API call will fail.
343
343
-**Timeout**: The default timeout is 230 seconds. Larger models may need the full timeout; smaller models like `gpt-5-nano` respond in seconds.
344
344
-**Cost**: Each call sends your query/index data to the AI provider and costs API credits. Use `@Top = 1` with sp_BlitzCache to limit costs during testing.
345
+
-**Context size**: If the `Context` column in your AI Providers table has a value greater than 0, the payload will be trimmed to that length to avoid exceeding the model's context window. Set `Context` to 0 or NULL for unlimited payload size.
346
+
-**Model nicknames**: The `@AIModel` parameter matches against both the `AI_Model` and `Model_Nickname` columns in your providers table. This lets you use friendly names like `'ChatGPT Slow'` instead of model identifiers like `'gpt-5.4'`.
345
347
-**Security**: Your query text, index definitions, and table structures are sent to the AI provider's API. Do not use this feature if your data or schema is subject to restrictions on external sharing.
0 commit comments