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
/* If we can't read it (permissions, offline, etc), just skip. */
5195
+
ENDCATCH;
5196
+
5197
+
FETCHNEXTFROM ai_db_cursor INTO @ai_db;
5198
+
END;
5199
+
5200
+
CLOSE ai_db_cursor;
5201
+
DEALLOCATE ai_db_cursor;
5202
+
5203
+
/* Update ai_prompt column with query metrics for rows that have query plans */
5204
+
UPDATE p
5205
+
SET ai_prompt =COALESCE(ai_prompt, N'') +N'---'+ @nl +N'This database has an extended property named CONSTITUTION.md that provides additional guidance for AI analysis. Here is the content of that property:'+ @nl +N'---'+ @nl +c.Constitution+ @nl +N'---'+ @nl
5206
+
FROM ##BlitzCacheProcs p
5207
+
INNER JOIN #ai_constitution c ONp.DatabaseName=c.DatabaseName
5208
+
WHEREp.SPID=@@SPID
5209
+
ANDc.ConstitutionISNOTNULL
5210
+
ANDLEN(c.Constitution) >0;
5211
+
5212
+
5122
5213
/* Update ai_prompt column with query metrics for rows that have query plans */
5123
5214
UPDATE p
5124
-
SET ai_prompt = N'Here are the performance metrics we are seeing in production, as measured by the plan cache:
5215
+
SET ai_prompt =COALESCE(ai_prompt, N'') +N'Here are the performance metrics we are seeing in production, as measured by the plan cache:
5125
5216
5126
-
Database: '+ISNULL(DatabaseName, N'Unknown') + N'
5217
+
Database: '+ISNULL(p.DatabaseName, N'Unknown') + N'
5127
5218
Query Type: '+ISNULL(QueryType, N'Unknown') + N'
5128
5219
Execution Count: '+ISNULL(CAST(ExecutionCount ASNVARCHAR(30)), N'N/A') + N'
5129
5220
Executions Per Minute: '+ISNULL(CAST(ExecutionsPerMinute ASNVARCHAR(30)), N'N/A') + N'
0 commit comments