Skip to content

Commit 2f77ec0

Browse files
Added index rebuild statement to output for 1180
1 parent 678a860 commit 2f77ec0

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

sqldb-tips/get-sqldb-tips-compat-level-100-only.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2620,7 +2620,13 @@ SELECT STRING_AGG(
26202620
', row overflow: ', FORMAT(partition_range_row_overflow_size_mb, 'N'),
26212621
', LOB: ', FORMAT(partition_range_lob_size_mb, 'N'),
26222622
'), present compression type: ', present_compression_type,
2623-
', suggested compression type: ', new_compression_type
2623+
', suggested compression type: ', new_compression_type,
2624+
', index rebuild statement: ', CONCAT(
2625+
'ALTER INDEX ', index_name, ' ON ', schema_name, '.', object_name,
2626+
' REBUILD', IIF(partition_range = '1-1', '', CONCAT(' PARTITION = <', partition_range, '>')),
2627+
' WITH (', 'DATA_COMPRESSION = ', new_compression_type, ',',
2628+
' ONLINE = ON (WAIT_AT_LOW_PRIORITY (MAX_DURATION = 15 MINUTES, ABORT_AFTER_WAIT = SELF)), RESUMABLE = ON);'
2629+
)
26242630
) AS nvarchar(max)), @CRLF
26252631
)
26262632
AS details

sqldb-tips/get-sqldb-tips.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2615,7 +2615,13 @@ SELECT STRING_AGG(
26152615
', row overflow: ', FORMAT(partition_range_row_overflow_size_mb, 'N'),
26162616
', LOB: ', FORMAT(partition_range_lob_size_mb, 'N'),
26172617
'), present compression type: ', present_compression_type,
2618-
', suggested compression type: ', new_compression_type
2618+
', suggested compression type: ', new_compression_type,
2619+
', index rebuild statement: ', CONCAT(
2620+
'ALTER INDEX ', index_name, ' ON ', schema_name, '.', object_name,
2621+
' REBUILD', IIF(partition_range = '1-1', '', CONCAT(' PARTITION = <', partition_range, '>')),
2622+
' WITH (', 'DATA_COMPRESSION = ', new_compression_type, ',',
2623+
' ONLINE = ON (WAIT_AT_LOW_PRIORITY (MAX_DURATION = 15 MINUTES, ABORT_AFTER_WAIT = SELF)), RESUMABLE = ON);'
2624+
)
26192625
) AS nvarchar(max)), @CRLF
26202626
)
26212627
WITHIN GROUP (ORDER BY object_size_mb DESC, object_name, index_name, partition_range, partition_range_total_size_mb, new_compression_type)

0 commit comments

Comments
 (0)