Skip to content

Commit 42aa50f

Browse files
Update sp_PerfCheck.sql
1 parent 476ea39 commit 42aa50f

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

sp_PerfCheck/sp_PerfCheck.sql

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,31 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34003400
N'https://erikdarling.com/sp_PerfCheck#tempdb'
34013401
);
34023402
END;
3403+
3404+
/* Check for percentage growth in tempdb */
3405+
IF @has_percent_growth = 1
3406+
BEGIN
3407+
INSERT INTO
3408+
#results
3409+
(
3410+
check_id,
3411+
priority,
3412+
category,
3413+
finding,
3414+
details,
3415+
url
3416+
)
3417+
VALUES
3418+
(
3419+
2006,
3420+
50, /* High-medium priority */
3421+
N'TempDB Configuration',
3422+
N'Percentage Auto-Growth Setting in TempDB',
3423+
N'TempDB data files are using percentage growth settings. This can lead to increasingly larger growth events as files grow. ' +
3424+
N'TempDB is recreated on server restart, so using predictable fixed-size growth is recommended for better performance.',
3425+
N'https://erikdarling.com/sp_PerfCheck#tempdb'
3426+
);
3427+
END;
34033428

34043429
/* Memory configuration checks */
34053430
IF @min_server_memory >= (@max_server_memory * 0.9) /* Within 10% */
@@ -4711,7 +4736,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47114736
details =
47124737
''Database data file is using percentage growth setting ('' +
47134738
CONVERT(nvarchar(20), mf.growth) +
4714-
''%). This can lead to increasingly larger growth events as the file grows,
4739+
''%). Current file size is '' +
4740+
CONVERT(nvarchar(20), CONVERT(decimal(18, 2), mf.size * 8.0 / 1024 / 1024)) +
4741+
'' GB. This can lead to increasingly larger growth events as the file grows,
47154742
potentially causing larger file sizes than intended. Even with instant file initialization enabled,
47164743
consider using a fixed size instead for more predictable growth.'',
47174744
url = N''https://erikdarling.com/sp_PerfCheck#DataFileGrowth''
@@ -4845,7 +4872,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48454872
object_name = mf.name,
48464873
details =
48474874
''Database file is using a very large fixed growth increment of '' +
4848-
CONVERT(nvarchar(20), CONVERT(decimal(18, 2), mf.growth * 8.0 / 1024 / 1024)) +
4875+
CONVERT(nvarchar(20), CONVERT(decimal(18, 2), mf.growth * CONVERT(decimal(18, 2), 8.0) / CONVERT(decimal(18, 2), 1024.0) / CONVERT(decimal(18, 2), 1024.0))) +
48494876
'' GB. Very large growth increments can lead to excessive space allocation. '' +
48504877
CASE
48514878
WHEN mf.type_desc = N''ROWS''
@@ -4856,7 +4883,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48564883
url = N''https://erikdarling.com/sp_PerfCheck#LargeGrowth''
48574884
FROM ' + QUOTENAME(@current_database_name) + N'.sys.database_files AS mf
48584885
WHERE mf.is_percent_growth = 0
4859-
AND mf.growth * 8.0 / 1024 / 1024 > 10; /* Growth > 10GB */';
4886+
AND mf.growth * CONVERT(decimal(18, 2), 8.0) / CONVERT(decimal(18, 2), 1024.0) / CONVERT(decimal(18, 2), 1024.0) > 10.0; /* Growth > 10GB */';
48604887

48614888
IF @debug = 1
48624889
BEGIN

0 commit comments

Comments
 (0)