Skip to content

Commit b66353d

Browse files
author
Darling Data
committed
Automation: Format and Build SQL File
1 parent 37adfdd commit b66353d

1 file changed

Lines changed: 24 additions & 14 deletions

File tree

Install-All/DarlingData.sql

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Compile Date: 04/17/2025 21:22:01 UTC
1+
-- Compile Date: 04/25/2025 15:13:54 UTC
22
SET ANSI_NULLS ON;
33
SET ANSI_PADDING ON;
44
SET ANSI_WARNINGS ON;
@@ -21360,7 +21360,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2136021360
name sysname NOT NULL,
2136121361
database_id integer NOT NULL,
2136221362
compatibility_level tinyint NOT NULL,
21363-
collation_name sysname NOT NULL,
21363+
collation_name sysname NULL,
2136421364
user_access_desc nvarchar(60) NOT NULL,
2136521365
is_read_only bit NOT NULL,
2136621366
is_auto_close_on bit NOT NULL,
@@ -21384,8 +21384,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2138421384
is_query_store_on bit NOT NULL,
2138521385
is_distributor bit NOT NULL,
2138621386
is_cdc_enabled bit NOT NULL,
21387-
target_recovery_time_in_seconds integer NOT NULL,
21388-
delayed_durability_desc nvarchar(60) NOT NULL,
21387+
target_recovery_time_in_seconds integer NULL,
21388+
delayed_durability_desc nvarchar(60) NULL,
2138921389
is_accelerated_database_recovery_on bit NOT NULL,
2139021390
is_ledger_on bit NULL
2139121391
);
@@ -21544,7 +21544,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2154421544
avg_wait_ms AS (wait_time_ms / NULLIF(waiting_tasks_count, 0)),
2154521545
percentage decimal(5, 2) NOT NULL,
2154621546
signal_wait_time_ms bigint NOT NULL,
21547-
wait_time_percent_of_uptime decimal(5, 2) NULL,
21547+
wait_time_percent_of_uptime decimal(6, 2) NULL,
2154821548
category nvarchar(50) NOT NULL
2154921549
);
2155021550

@@ -23354,7 +23354,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2335423354
THEN 0
2335523355
ELSE CONVERT(decimal(18, 2), SUM(fs.io_stall_write_ms) * 1.0 / SUM(fs.num_of_writes))
2335623356
END,
23357-
total_size_mb = CONVERT(decimal(18, 2), SUM(mf.size) * 8.0 / 1024.0)
23357+
total_size_mb = CONVERT(decimal(18, 2), SUM(CONVERT(bigint, mf.size)) * 8.0 / 1024.0)
2335823358
FROM sys.dm_io_virtual_file_stats
2335923359
(' +
2336023360
CASE
@@ -23554,9 +23554,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2355423554
CONVERT(nvarchar(10), CONVERT(decimal(10, 2), io.avg_write_stall_ms)) +
2355523555
N' ms. ' +
2355623556
N'Total read: ' +
23557-
CONVERT(nvarchar(20), CONVERT(decimal(10, 2), io.read_io_mb)) +
23557+
CONVERT(nvarchar(20), CONVERT(decimal(18, 2), io.read_io_mb)) +
2355823558
N' MB, Total write: ' +
23559-
CONVERT(nvarchar(20), CONVERT(decimal(10, 2), io.write_io_mb)) +
23559+
CONVERT(nvarchar(20), CONVERT(decimal(18, 2), io.write_io_mb)) +
2356023560
N' MB. ' +
2356123561
N'This indicates slow I/O subsystem performance for this database.',
2356223562
url = N'https://erikdarling.com/sp_PerfCheck#IOStalls'
@@ -26824,7 +26824,7 @@ OPTION(MAXDOP 1, RECOMPILE);',
2682426824
writes bigint NULL,
2682526825
logical_reads bigint NULL,
2682626826
granted_query_memory_gb decimal(38,2) NULL,
26827-
transaction_isolation_level nvarchar(30) NULL,
26827+
transaction_isolation_level sysname NULL,
2682826828
dop integer NULL,
2682926829
parallel_worker_count integer NULL,
2683026830
plan_handle varbinary(64) NULL,
@@ -30381,6 +30381,7 @@ ALTER PROCEDURE
3038130381
@regression_comparator varchar(20) = NULL, /*what difference to use ('relative' or 'absolute') when comparing @sort_order's metric for the normal time period with the regression time period.*/
3038230382
@regression_direction varchar(20) = NULL, /*when comparing against the regression baseline, want do you want the results sorted by ('magnitude', 'improved', or 'regressed')?*/
3038330383
@include_query_hash_totals bit = 0, /*will add an additional column to final output with total resource usage by query hash, may be skewed by query_hash and query_plan_hash bugs with forced plans/plan guides*/
30384+
@include_maintenance bit = 0, /*Set this bit to 1 to add maintenance operations such as index creation to the result set*/
3038430385
@help bit = 0, /*return available parameter details, etc.*/
3038530386
@debug bit = 0, /*prints dynamic sql, statement length, parameter and variable values, and raw temp table contents*/
3038630387
@troubleshoot_performance bit = 0, /*set statistics xml on for queries against views*/
@@ -30496,6 +30497,7 @@ BEGIN
3049630497
WHEN N'@regression_comparator' THEN 'what difference to use (''relative'' or ''absolute'') when comparing @sort_order''s metric for the normal time period with any regression time period.'
3049730498
WHEN N'@regression_direction' THEN 'when comparing against any regression baseline, what do you want the results sorted by (''magnitude'', ''improved'', or ''regressed'')?'
3049830499
WHEN N'@include_query_hash_totals' THEN N'will add an additional column to final output with total resource usage by query hash, may be skewed by query_hash and query_plan_hash bugs with forced plans/plan guides'
30500+
WHEN N'@include_maintenance' THEN N'Set this bit to 1 to add maintenance operations such as index creation to the result set'
3049930501
WHEN N'@help' THEN 'how you got here'
3050030502
WHEN N'@debug' THEN 'prints dynamic sql, statement length, parameter and variable values, and raw temp table contents'
3050130503
WHEN N'@troubleshoot_performance' THEN 'set statistics xml on for queries against views'
@@ -30551,6 +30553,7 @@ BEGIN
3055130553
WHEN N'@regression_comparator' THEN 'relative, absolute'
3055230554
WHEN N'@regression_direction' THEN 'regressed, worse, improved, better, magnitude, absolute, whatever'
3055330555
WHEN N'@include_query_hash_totals' THEN N'0 or 1'
30556+
WHEN N'@include_maintenance' THEN N'0 or 1'
3055430557
WHEN N'@help' THEN '0 or 1'
3055530558
WHEN N'@debug' THEN '0 or 1'
3055630559
WHEN N'@troubleshoot_performance' THEN '0 or 1'
@@ -30606,6 +30609,7 @@ BEGIN
3060630609
WHEN N'@regression_comparator' THEN 'NULL; absolute if @regression_baseline_start_date is specified'
3060730610
WHEN N'@regression_direction' THEN 'NULL; regressed if @regression_baseline_start_date is specified'
3060830611
WHEN N'@include_query_hash_totals' THEN N'0'
30612+
WHEN N'@include_maintenance' THEN N'0'
3060930613
WHEN N'@help' THEN '0'
3061030614
WHEN N'@debug' THEN '0'
3061130615
WHEN N'@troubleshoot_performance' THEN '0'
@@ -31063,7 +31067,7 @@ Hold plan_ids for matching wait filter
3106331067
CREATE TABLE
3106431068
#wait_filter
3106531069
(
31066-
plan_id bigint PRIMARY KEY
31070+
plan_id bigint PRIMARY KEY CLUSTERED
3106731071
);
3106831072

3106931073
/*
@@ -31557,19 +31561,19 @@ CREATE TABLE
3155731561
CREATE TABLE
3155831562
#include_databases
3155931563
(
31560-
database_name sysname PRIMARY KEY
31564+
database_name sysname PRIMARY KEY CLUSTERED
3156131565
);
3156231566

3156331567
CREATE TABLE
3156431568
#exclude_databases
3156531569
(
31566-
database_name sysname PRIMARY KEY
31570+
database_name sysname PRIMARY KEY CLUSTERED
3156731571
);
3156831572

3156931573
CREATE TABLE
3157031574
#requested_but_skipped_databases
3157131575
(
31572-
database_name sysname PRIMARY KEY,
31576+
database_name sysname PRIMARY KEY CLUSTERED,
3157331577
reason varchar(100) NOT NULL
3157431578
);
3157531579

@@ -32997,6 +33001,8 @@ SELECT
3299733001
ISNULL(@workdays, 0),
3299833002
@include_query_hash_totals =
3299933003
ISNULL(@include_query_hash_totals, 0),
33004+
@include_maintenance =
33005+
ISNULL(@include_maintenance, 0),
3300033006
/*
3300133007
doing start and end date last because they're more complicated
3300233008
if start or end date is null,
@@ -35426,7 +35432,8 @@ END;
3542635432
/*
3542735433
This section screens out index create and alter statements because who cares
3542835434
*/
35429-
35435+
IF @include_maintenance = 0
35436+
BEGIN
3543035437
SELECT
3543135438
@current_table = 'inserting #maintenance_plans',
3543235439
@sql = @isolation_level;
@@ -35506,6 +35513,7 @@ SELECT
3550635513
FROM #maintenance_plans AS mp
3550735514
WHERE mp.plan_id = qsrs.plan_id
3550835515
)' + @nc10;
35516+
END;
3550935517

3551035518
/*
3551135519
Tidy up the where clause a bit
@@ -40489,6 +40497,8 @@ BEGIN
4048940497
@regression_direction,
4049040498
include_query_hash_totals =
4049140499
@include_query_hash_totals,
40500+
include_maintenance =
40501+
@include_maintenance,
4049240502
help =
4049340503
@help,
4049440504
debug =

0 commit comments

Comments
 (0)