Skip to content

Commit

Permalink
Merge pull request #383 from erikdarlingdata/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
erikdarlingdata authored Mar 25, 2024
2 parents 5f1267f + 63e2267 commit 0097357
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
13 changes: 4 additions & 9 deletions sp_PressureDetector/sp_PressureDetector.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1225,16 +1225,11 @@ OPTION(MAXDOP 1, RECOMPILE);',
)
AND p.counter_name IN
(
N'Forwarded Records/sec', N'Table Lock Escalations/sec',
N'Checkpoint pages/sec', N'Database pages', N'Page reads/sec', N'Page writes/sec', N'Active Transactions',
N'Log Bytes Flushed/sec', N'Log Flush Wait Time', N'Log Flush Waits/sec', N'Log Flush Write Time (ms)',
N'Log Flushes/sec', N'Transactions/sec', N'Lock Requests/sec', N'Lock Timeouts/sec', N'Lock Wait Time (ms)',
N'Lock Waits/sec', N'Number of Deadlocks/sec', N'Database Cache Memory (KB)',
N'Free Memory (KB)', N'Granted Workspace Memory (KB)', N'Lock Memory (KB)', N'Memory Grants Outstanding',
N'Memory Grants Pending', N'Optimizer Memory (KB)', N'SQL Cache Memory (KB)',
N'Forwarded Records/sec', N'Table Lock Escalations/sec', N'Page reads/sec', N'Page writes/sec',
N'Transactions/sec', N'Lock Requests/sec', N'Lock Wait Time (ms)', N'Lock Waits/sec', N'Number of Deadlocks/sec',
N'Granted Workspace Memory (KB)', N'Lock Memory (KB)', N'Memory Grants Pending', N'SQL Cache Memory (KB)',
N'Stolen Server Memory (KB)', N'Target Server Memory (KB)', N'Total Server Memory (KB)',
N'Batch Requests/sec', N'SQL Compilations/sec', N'SQL Re-Compilations/sec',
N'Longest Transaction Running Time',
N'Batch Requests/sec', N'SQL Compilations/sec', N'SQL Re-Compilations/sec', N'Longest Transaction Running Time',
N'Lock waits', N'Log buffer waits', N'Log write waits', N'Memory grant queue waits', N'Network IO waits',
N'Non-Page latch waits', N'Page IO latch waits', N'Page latch waits', N'Thread-safe memory objects waits',
N'Wait for the worker', N'Active parallel threads', N'Active requests', N'Blocked tasks',
Expand Down
26 changes: 25 additions & 1 deletion sp_QuickieStore/sp_QuickieStore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ DECLARE
@queries_top bigint,
@nc10 nvarchar(2),
@where_clause nvarchar(MAX),
@query_text_search_original_value nvarchar(4000),
@procedure_exists bit,
@query_store_exists bit,
@query_store_trouble bit,
Expand All @@ -1154,14 +1155,31 @@ DECLARE
@work_start_utc time(0),
@work_end_utc time(0);

/*
In cases where we are escaping @query_text_search and
looping over multiple databases, we need to make sure
to not escape the string more than once.
The solution is to reset to the original value each loop.
This therefore needs to be done before the cursor.
*/
IF
(
@get_all_databases = 1
AND @escape_brackets = 1
)
BEGIN
SELECT
@query_text_search_original_value = @query_text_search;
END;

/*
This section is in a cursor whether we
hit one database, or multiple
I do all the variable assignment in the
cursor block because some of them
are are assigned for the specific database
are assigned for the specific database
that is currently being looked at
*/
INSERT
Expand Down Expand Up @@ -1301,6 +1319,12 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;',
END,
@nc10 = NCHAR(10),
@where_clause = N'',
@query_text_search =
CASE
WHEN @get_all_databases = 1 AND @escape_brackets = 1
THEN @query_text_search_original_value
ELSE @query_text_search
END,
@procedure_exists = 0,
@query_store_exists = 0,
@query_store_trouble = 0,
Expand Down

0 comments on commit 0097357

Please sign in to comment.