Blog Post

In SQL Server 2022, set your transaction log file autogrowth rate to 64 MB

,

A late-breaking change that arrived in SQL Server 2022 is an important one that could be a new line item in your health checks.

The basics:

Starting with SQL Server 2022, transaction log file growth events up to 64 MB in size can benefit from instant file initialization (IFI). As usual, the transaction log is otherwise unable to benefit from instant file initialization.

This should be a big performance improvement if your transaction log files unexpectedly grow. Of course, you should try to avoid autogrowth events altogether.

There's lots more cool new stuff in SQL Server 2022, too.

Impact to health checks:

The default autogrowth rate for transaction log files in new databases is already 64 MB. Unless you have specific needs for your workload, consider keeping this default now, considering the dramatic advantage IFI brings to file space allocation.

In both your database and log files you should proactively pre-allocate enough space to avoid autogrowth events anyway. Regularly monitor the space in database files to prevent autogrowth events. The proactive DBA, outside of busy hours, should grow database data and log files manually, so that they do not autogrow during busy hours.

And whatever you do, don't shrink your data and log files, only to have them autogrow again the next business cycle.

Details:

  • Applies to both manual file size changes and autogrowth events <=64 MB.
  • Transaction log growth events larger than 64 MB are unaffected by this performance improvement. No change.
  • Still no IFI for database restores or initial transaction log file initialization for new databases.
  • This change to autogrowth events up to 64 MB is new for SQL Server 2022, and arrives Azure SQL Database soon if not already, from what I understand.
  • It is not yet available for Azure SQL Managed Instance, but I would guess it will be there soon.
  • This feature is available on all editions of SQL Server.

Make sure IFI is enabled:

Of course, this only works if your SQL Server instance is capable of instant file initialization. The SQL Server service account must be granted the Perform Volume Maintenance Tasks permission in Local Security Policy on the Windows server. A quick script works for modern versions of SQL Server:

SELECT servicename, instant_file_initialization_enabled
FROM sys.dm_server_services
WHEREfilenameLIKE'%sqlservr.exe%';

 

Original post (opens in new tab)

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating