Skip to content

Commit

Permalink
Merge pull request #389 from erikdarlingdata/dev
Browse files Browse the repository at this point in the history
QuickieStore AG filtering
  • Loading branch information
erikdarlingdata authored Mar 30, 2024
2 parents 02da061 + e7120ad commit af067b9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sp_PressureDetector/sp_PressureDetector.sql
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,11 @@ OPTION(MAXDOP 1, RECOMPILE);',
(w2.hours_wait_time - w.hours_wait_time) / 1000.
),
avg_ms_per_wait =
(w2.avg_ms_per_wait + w.avg_ms_per_wait) / 2,
CONVERT
(
decimal(38,1),
(w2.avg_ms_per_wait + w.avg_ms_per_wait) / 2
),
percent_signal_waits =
CONVERT
(
Expand Down Expand Up @@ -1094,13 +1098,13 @@ OPTION(MAXDOP 1, RECOMPILE);',
fm.database_file_details,
fm.file_size_gb,
avg_read_stall_ms =
(fm2.avg_read_stall_ms - fm.avg_read_stall_ms),
(fm2.avg_read_stall_ms + fm.avg_read_stall_ms) / 2,
avg_write_stall_ms =
(fm2.avg_write_stall_ms - fm.avg_write_stall_ms),
(fm2.avg_write_stall_ms + fm.avg_write_stall_ms) / 2,
total_read_stall =
(
(fm2.avg_read_stall_ms + fm2.avg_write_stall_ms) -
(fm.avg_read_stall_ms + fm.avg_write_stall_ms)
(fm2.avg_read_stall_ms + fm2.avg_write_stall_ms) +
(fm.avg_read_stall_ms + fm.avg_write_stall_ms) / 2
),
total_gb_read =
(fm2.total_gb_read - fm.total_gb_read),
Expand Down
15 changes: 15 additions & 0 deletions sp_QuickieStore/sp_QuickieStore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,21 @@ FROM sys.databases AS d
WHERE @get_all_databases = 1
AND d.is_query_store_on = 1
AND d.database_id > 4
AND d.state = 0
AND d.is_in_standby = 0
AND d.is_read_only = 0
AND NOT EXISTS
(
SELECT
1/0
FROM sys.dm_hadr_availability_replica_states AS s
JOIN sys.availability_databases_cluster AS c
ON s.group_id = c.group_id
AND d.name = c.database_name
WHERE s.is_local <> 1
AND s.role_desc <> N'PRIMARY'
AND DATABASEPROPERTYEX(c.database_name, N'Updateability') <> N'READ_WRITE'
)
OPTION(RECOMPILE);

DECLARE
Expand Down

0 comments on commit af067b9

Please sign in to comment.