Microsoft Certified IT Professional Rudi Bruchez EI Microsoft Certified IT Professional

Rudi Bruchez EI · www.pachadata.com · rudi@pachadata.com · +33 6 22 48 76 99
Consulting, audit, performance tuning, solutions, training
SQL Server OLTP and BI / NoSQL

Version of December 2, 2026 (8ab52429) · https://www.pachadata.com/en/docs/reference/engine-constants/

SQL Server engine constants

Fixed thresholds and sizes in SQL Server (statistics, columnstore, VLFs, plan cache, locks, Query Store), with their version and source.

Page co-written with Claude, who collected the sources and ran the measurements.

How to read these tables

Each row gives a fixed engine value, hard-coded or default, and its source. The link points to the Microsoft documentation page that gives it. “Measured” means that I checked it on two lab instances, SQL Server 2022 CU26 and SQL Server 2025 CU11, both on Linux. The measurement scripts are at the end of the page.

The default values of a configuration option are read on the instance, in sys.configurations (a computed value, such as max worker threads at 0, is read in its status view); hard-coded constants, on the other hand, cannot be read anywhere and are deduced from a measurement.

Statistics

ConstantValueVersionSource
Automatic update threshold, table of 500 rows or fewer500 modificationsallStatistics, measured (400 rows: nothing at 499, update at 500)
Threshold, more than 500 rows, compatibility level 120 or lower500 + 20% of the rowsup to 2014, or level 120 and lowerStatistics, measured (100,000 rows: update after 20,500 modifications)
Threshold, more than 500 rows, level 130 and higherthe smaller of 500 + 20% and the square root of 1,000 × rowssince 2016Statistics, measured (100,000 rows: update after 10,000 modifications)
Threshold, temporary table of fewer than 6 rows6 modificationsallStatistics
Number of histogram steps200 at most according to the documentation; 201 measured when the column contains NULL values (the NULL step can also be one of the 200)200: all; 201: measured on 2022 and 2025Statistics, measured (steps = 201 in sys.dm_db_stats_properties for a column that contains NULL values)

The square root wins above about 19,700 rows. For 100,000 rows, the threshold goes from 20,500 modifications to 10,000; for 10 million rows, from 2,000,500 to 100,000. Trace flag 2371 enables the square-root threshold from SQL Server 2008 R2 SP1 to 2014, and in 2016 and later when the database compatibility level is 120 or lower.

The counter is read in modification_counter of sys.dm_db_stats_properties. The update does not happen when the threshold is crossed, but at the next compilation of a query that needs the statistic, or before the execution of a cached plan that uses it. With AUTO_UPDATE_STATISTICS_ASYNC, the query does not wait for the update.

Columnstore and batch mode

ConstantValueVersionSource
Maximum rows in a rowgroup1,048,576allColumnstore indexes: data loading guidance, measured (1,048,577 rows: one compressed rowgroup of 1,048,576 and one row in the delta store)
Threshold for loading directly into a compressed rowgroup102,400 rows per batchallColumnstore indexes: data loading guidance, measured (102,400 rows: compressed rowgroup; 102,399: open delta store)
Rows in a batch in batch mode900 in generalallColumnstore indexes: query performance

The 102,400-row threshold is counted per load batch; the measurements above are made with MAXDOP 1. A rowgroup can also be closed smaller, for lack of memory or when its dictionary is full: the reason is read in trim_reason_desc of sys.dm_db_column_store_row_group_physical_stats.

Transaction log and VLFs

Log growthWindows (NTFS), 2022 and laterLinux, 2022 and 2025 (measured)What the documentation says
less than 1/8 of the current size111
64 MB or less14less than 64 MB: 4; 1 since SQL Server 2022
more than 64 MB, up to 1 GB88from 64 MB to 1 GB: 8
more than 1 GB161616

The rule comes from the transaction log architecture guide. The one-eighth rule is tested first: a 2,210 MB log that grows by 64 MB gets a single VLF. The measured boundaries are inclusive: a growth of exactly 64 MB creates 4 VLFs on Linux, whereas the documentation puts 64 MB in the tier of 8; a growth of 1,024 MB creates 8, a growth of 1,025 MB creates 16. File creation follows the same scale: a log created at 64 MB has 4 VLFs.

Since SQL Server 2022, a growth of 64 MB or less creates only one VLF. This is the counterpart of another 2022 change: a log growth of up to 64 MB can benefit from instant file initialization, with no zeroing. This holds on Windows, on NTFS: measured in my lab on SQL Server 2025 CU9. On Linux, in 2022 CU26 as in 2025 CU11, a growth of 32 or 64 MB still creates 4 VLFs, whether manual or automatic: the old scale applies.

Beyond 10,000 VLFs, SQL Server writes message 9017 to the error log when the database starts (instance restart, restore, attach), since SQL Server 2012. The number of VLFs is read in sys.dm_db_log_info.

Parallelism and workers

ConstantValueVersionSource
cost threshold for parallelism default5allcost threshold for parallelism
Computed max worker threads, 64-bit, 4 processors or fewer512allmax worker threads
Computed max worker threads, 5 to 64 processors512 + (processors - 4) × 16allmax worker threads, measured (22 processors: 800 in sys.dm_os_sys_info)
Computed max worker threads, more than 64 processors512 + (processors - 4) × 32since 2016 SP2 and 2017max worker threads

Since SQL Server 2017, the documentation announces a computed value divided by two on a machine with less than 2 GB of memory.

Locks

ConstantValueVersionSource
Lock escalation threshold5,000 locks on a single table by one statement, checked every 1,250 locks acquiredallTransaction locking and row versioning guide
Threshold check, and retry after a failureevery 1,250 locks acquiredallTransaction locking and row versioning guide

The threshold is counted per statement and per reference to the table, not per transaction. The engine checks the threshold only at each block of 1,250 locks acquired: an UPDATE with ROWLOCK on a 20,000-row table keeps its 6,230 key locks, and escalates to an X lock on the table only at 6,235 rows, when the total number of locks (rows, pages, object) reaches 6,250 (measured on 2022 CU26 and 2025 CU11). Escalation also triggers when the instance’s lock memory exceeds its threshold. With the optimized locking of SQL Server 2025, under READ COMMITTED, row and page locks are released as soon as the row is modified, and escalation becomes much rarer (Transaction locking and row versioning guide).

Plan cache

ConstantValueVersionSource
Hash table buckets, SQL Plans and Object Plans stores40,009 on 64-bit by default, 160,001 with trace flag 174allsys.dm_exec_cached_plans, measured in sys.dm_os_memory_cache_hash_tables
Buckets of the Bound Trees store4,001allsys.dm_exec_cached_plans, measured
Number of literals beyond which forced parameterization does not apply2,097allQuery processing architecture guide

Query Store

OptionDefaultVersionSource
MAX_STORAGE_SIZE_MB1,000 MB (100 MB in 2016 and 2017)since 2019ALTER DATABASE SET, measured
QUERY_CAPTURE_MODEAUTO (ALL in 2016 and 2017)since 2019ALTER DATABASE SET, measured
STALE_QUERY_THRESHOLD_DAYS30 daysallALTER DATABASE SET, measured
DATA_FLUSH_INTERVAL_SECONDS900 secondsallALTER DATABASE SET, measured
INTERVAL_LENGTH_MINUTES60 minutesallALTER DATABASE SET, measured
MAX_PLANS_PER_QUERY200allALTER DATABASE SET, measured
Capture thresholds of AUTO mode30 executions, or 1 second of compile CPU, or 100 ms of execution CPU, accumulated over one daysince 2019ALTER DATABASE SET

Since SQL Server 2022, Query Store is enabled by default on new databases; a restored or upgraded database keeps its setting. “Measured” here means read in sys.database_query_store_options of a new database, on both versions.

Storage and read-ahead

ConstantValueVersionSource
Page size8 KBallPages and extents architecture guide
Extent size64 KB (8 pages)allPages and extents architecture guide
Maximum row size in the page8,060 bytesallPages and extents architecture guide
Uniqueifier of a non-unique clustered index4 bytes, filled in only for key duplicatesallSQL Server index design guide, measured
Read-ahead64 contiguous pages (512 KB) at most per readallReading pages

The uniqueifier is stored like a variable-length column. On a table with no other variable column, a duplicate therefore costs 8 bytes: the 4 of the value and the 4 of the variable column array (17 bytes per row, 25 for a duplicate). If the table already has a variable column, each row costs 2 bytes more, even without a duplicate, for the entry of the uniqueifier in that array, and a duplicate costs 4 bytes more still (22 bytes for the table with a unique key, 24 and 28 for the table with a non-unique key).

Network, recovery, high availability

ConstantValueVersionSource
network packet size default4,096 bytesallnetwork packet size
TARGET_RECOVERY_TIME of a new database60 seconds (indirect checkpoint)since 2016ALTER DATABASE SET, measured (target_recovery_time_in_seconds in sys.databases)
SESSION_TIMEOUT of an availability group replica10 seconds, 5 at minimumallALTER AVAILABILITY GROUP

Redoing the measurements

Measurement scripts

The first three scripts create a lab database and drop it at the end; the last one only reads a view. None of them changes any instance configuration.

-- Automatic statistics update threshold, 100,000 rows
CREATE DATABASE LaboConstantes;
GO
USE LaboConstantes;
ALTER DATABASE LaboConstantes SET AUTO_UPDATE_STATISTICS ON;
GO
WITH n AS (
    SELECT TOP (100000) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS i
    FROM sys.all_columns AS c1
    CROSS JOIN sys.all_columns AS c2
)
SELECT CAST(i AS int) AS id, CAST(i % 1000 AS int) AS a
INTO dbo.S
FROM n;
CREATE STATISTICS st_a ON dbo.S (a) WITH FULLSCAN;
GO
-- 9,999 modifications: the statistic is not recomputed (level 130 and later)
UPDATE TOP (9999) dbo.S SET a = a + 0;
SELECT COUNT(*) FROM dbo.S WHERE a = 5 OPTION (RECOMPILE);
SELECT modification_counter
FROM sys.dm_db_stats_properties(OBJECT_ID('dbo.S'), 2);   -- 9999
GO
-- one more: the next compilation recomputes the statistic
UPDATE TOP (1) dbo.S SET a = a + 0;
SELECT COUNT(*) FROM dbo.S WHERE a = 5 OPTION (RECOMPILE);
SELECT modification_counter
FROM sys.dm_db_stats_properties(OBJECT_ID('dbo.S'), 2);   -- 0
GO
USE master;
DROP DATABASE LaboConstantes;
-- Rowgroups: 1,048,577 rows, then 102,400 and 102,399
CREATE DATABASE LaboConstantes;
GO
USE LaboConstantes;
CREATE TABLE dbo.C1 (i int, INDEX cci CLUSTERED COLUMNSTORE);
CREATE TABLE dbo.C2 (i int, INDEX cci CLUSTERED COLUMNSTORE);
CREATE TABLE dbo.C3 (i int, INDEX cci CLUSTERED COLUMNSTORE);
GO
WITH n AS (
    SELECT TOP (1048577) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS i
    FROM sys.all_columns AS c1
    CROSS JOIN sys.all_columns AS c2
    CROSS JOIN sys.all_columns AS c3
)
INSERT dbo.C1 WITH (TABLOCK) SELECT i FROM n OPTION (MAXDOP 1);
WITH n AS (
    SELECT TOP (102400) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS i
    FROM sys.all_columns AS c1
    CROSS JOIN sys.all_columns AS c2
)
INSERT dbo.C2 WITH (TABLOCK) SELECT i FROM n OPTION (MAXDOP 1);
WITH n AS (
    SELECT TOP (102399) ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS i
    FROM sys.all_columns AS c1
    CROSS JOIN sys.all_columns AS c2
)
INSERT dbo.C3 WITH (TABLOCK) SELECT i FROM n OPTION (MAXDOP 1);
GO
SELECT OBJECT_NAME(object_id) AS table_name, state_desc, total_rows
FROM sys.dm_db_column_store_row_group_physical_stats
WHERE object_id IN (OBJECT_ID('dbo.C1'), OBJECT_ID('dbo.C2'), OBJECT_ID('dbo.C3'))
ORDER BY object_id, row_group_id;
GO
USE master;
DROP DATABASE LaboConstantes;
-- VLFs created by log growth
CREATE DATABASE LaboConstantes
ON (NAME = d, FILENAME = '/var/opt/mssql/data/LaboConstantes.mdf', SIZE = 64MB)
LOG ON (NAME = l, FILENAME = '/var/opt/mssql/data/LaboConstantes.ldf', SIZE = 64MB);
GO
USE LaboConstantes;
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 4
ALTER DATABASE LaboConstantes MODIFY FILE (NAME = l, SIZE = 96MB);    -- +32 MB
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 8: 4 more
ALTER DATABASE LaboConstantes MODIFY FILE (NAME = l, SIZE = 160MB);   -- +64 MB
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 12: 4 more
ALTER DATABASE LaboConstantes MODIFY FILE (NAME = l, SIZE = 161MB);   -- +1 MB, less than 1/8
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 13: 1 more
ALTER DATABASE LaboConstantes MODIFY FILE (NAME = l, SIZE = 1185MB);  -- +1,024 MB
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 21: 8 more
ALTER DATABASE LaboConstantes MODIFY FILE (NAME = l, SIZE = 2210MB);  -- +1,025 MB
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 37: 16 more
ALTER DATABASE LaboConstantes MODIFY FILE (NAME = l, SIZE = 2274MB);  -- +64 MB, less than 1/8
SELECT COUNT(*) AS vlf FROM sys.dm_db_log_info(DB_ID());   -- 38: 1 more
GO
USE master;
DROP DATABASE LaboConstantes;

The file paths are those of a Linux instance; on Windows, replace them with the instance’s data folder.

-- Plan cache buckets
SELECT name, type, buckets_count
FROM sys.dm_os_memory_cache_hash_tables
WHERE type IN ('CACHESTORE_SQLCP', 'CACHESTORE_OBJCP', 'CACHESTORE_PHDR');

Contact

I have been an independent SQL Server consultant since 2006. I help when an application slows down, when a server costs too much in storage or licenses, or when a migration must not stop production: audit and diagnosis, query and index tuning, migrations, high availability, training. On site, or as a remote audit delivered in five working days.

rudi@pachadata.com · +33 6 22 48 76 99 · www.pachadata.com/en/contact/