Skip to content

Commit f999f02

Browse files
Merge pull request #687 from erikdarlingdata/dev
March 1 2026 release (v2)
2 parents d564a43 + afe6504 commit f999f02

1 file changed

Lines changed: 147 additions & 0 deletions

File tree

sp_QuickieStore/sp_QuickieStore.sql

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,21 @@ CREATE TABLE
14781478
replica_group_id bigint NOT NULL
14791479
);
14801480

1481+
/*
1482+
Tuning In, Tuning Out
1483+
*/
1484+
CREATE TABLE
1485+
#database_automatic_tuning_configurations
1486+
(
1487+
database_id integer NOT NULL,
1488+
[option] nvarchar(120) NULL,
1489+
option_value nvarchar(120) NULL,
1490+
[type] nvarchar(120) NULL,
1491+
type_value nvarchar(120) NULL,
1492+
details nvarchar(4000) NULL,
1493+
[state] integer NULL
1494+
);
1495+
14811496
/*
14821497
Trouble Loves Me
14831498
*/
@@ -8554,6 +8569,87 @@ OPTION(RECOMPILE);' + @nc10;
85548569
@current_table;
85558570
END;
85568571
END; /*End AG queries*/
8572+
8573+
/*database_automatic_tuning_configurations*/
8574+
SELECT
8575+
@current_table = 'inserting #database_automatic_tuning_configurations',
8576+
@sql = @isolation_level;
8577+
8578+
IF @troubleshoot_performance = 1
8579+
BEGIN
8580+
EXECUTE sys.sp_executesql
8581+
@troubleshoot_insert,
8582+
N'@current_table nvarchar(100)',
8583+
@current_table;
8584+
8585+
SET STATISTICS XML ON;
8586+
END;
8587+
8588+
SELECT
8589+
@sql += N'
8590+
SELECT
8591+
@database_id,
8592+
datc.[option],
8593+
datc.option_value,
8594+
datc.[type],
8595+
type_value =
8596+
CONVERT
8597+
(
8598+
nvarchar(120),
8599+
datc.type_value
8600+
),
8601+
datc.details,
8602+
datc.[state]
8603+
FROM ' + @database_name_quoted + N'.sys.database_automatic_tuning_configurations AS datc
8604+
WHERE EXISTS
8605+
(
8606+
SELECT
8607+
1/0
8608+
FROM #query_store_plan AS qsp
8609+
WHERE TRY_CAST(datc.type_value AS bigint) = qsp.query_id
8610+
)
8611+
OPTION(RECOMPILE);' + @nc10;
8612+
8613+
IF @debug = 1
8614+
BEGIN
8615+
PRINT LEN(@sql);
8616+
PRINT @sql;
8617+
END;
8618+
8619+
INSERT
8620+
#database_automatic_tuning_configurations
8621+
WITH
8622+
(TABLOCK)
8623+
(
8624+
database_id,
8625+
[option],
8626+
option_value,
8627+
[type],
8628+
type_value,
8629+
details,
8630+
[state]
8631+
)
8632+
EXECUTE sys.sp_executesql
8633+
@sql,
8634+
N'@database_id integer',
8635+
@database_id;
8636+
8637+
IF @troubleshoot_performance = 1
8638+
BEGIN
8639+
SET STATISTICS XML OFF;
8640+
8641+
EXECUTE sys.sp_executesql
8642+
@troubleshoot_update,
8643+
N'@current_table nvarchar(100)',
8644+
@current_table;
8645+
8646+
EXECUTE sys.sp_executesql
8647+
@troubleshoot_info,
8648+
N'@sql nvarchar(max),
8649+
@current_table nvarchar(100)',
8650+
@sql,
8651+
@current_table;
8652+
END;
85578653
END; /*End SQL 2022 views*/
85588654

85598655
FETCH NEXT
@@ -9295,6 +9391,34 @@ BEGIN
92959391
END;
92969392
END;
92979393
END; /*@ags_present*/
9394+
9395+
IF @expert_mode = 1
9396+
BEGIN
9397+
IF EXISTS
9398+
(
9399+
SELECT
9400+
1/0
9401+
FROM #database_automatic_tuning_configurations AS datc
9402+
)
9403+
BEGIN
9404+
SELECT
9405+
@current_table = 'selecting #database_automatic_tuning_configurations';
9406+
9407+
SELECT
9408+
database_name =
9409+
DB_NAME(datc.database_id),
9410+
datc.[option],
9411+
datc.option_value,
9412+
datc.[type],
9413+
datc.type_value,
9414+
datc.details,
9415+
datc.[state]
9416+
FROM #database_automatic_tuning_configurations AS datc
9417+
ORDER BY
9418+
datc.[option]
9419+
OPTION(RECOMPILE);
9420+
END;
9421+
END;
92989422
END; /*End 2022 views*/
92999423

93009424
IF @expert_mode = 1
@@ -11620,6 +11744,29 @@ BEGIN
1162011744
END;
1162111745
END;
1162211746

11747+
IF EXISTS
11748+
(
11749+
SELECT
11750+
1/0
11751+
FROM #database_automatic_tuning_configurations AS datc
11752+
)
11753+
BEGIN
11754+
SELECT
11755+
table_name =
11756+
'#database_automatic_tuning_configurations',
11757+
datc.*
11758+
FROM #database_automatic_tuning_configurations AS datc
11759+
ORDER BY
11760+
datc.[option]
11761+
OPTION(RECOMPILE);
11762+
END;
11763+
ELSE
11764+
BEGIN
11765+
SELECT
11766+
result =
11767+
'#database_automatic_tuning_configurations is empty';
11768+
END;
11769+
1162311770
IF EXISTS
1162411771
(
1162511772
SELECT

0 commit comments

Comments
 (0)