// sql server · memory

locked pages in memory

Windows right that stops the OS paging the Database Engine's buffer pool memory to disk.

Par défaut
Not granted
Range
Granted or not granted
Restart needed
Non
Default checked on
SQL Server 2025

Ce que cela fait

With the Lock pages in memory right granted, SQL Server locks the pages its memory manager allocates, and the OS cannot page them out. LPIM does not stop SQL Server releasing memory on request, and max server memory still caps what it locks; Microsoft strongly recommends setting that upper limit before granting the right. On Linux the privilege does not exist: mssql-conf memory.memorylimitmb is the way to bound the process there.

Valeur par défaut

Not granted. Windows only. sys.dm_os_sys_info.sql_memory_model_desc reports CONVENTIONAL, LOCK_PAGES or LARGE_PAGES (SQL Server 2016 SP1 and later).

Check the current value

SELECT sql_memory_model_desc FROM sys.dm_os_sys_info;

-- nonzero rows mean pages are actually locked
SELECT memory_node_id, locked_page_allocations_kb
FROM sys.dm_os_memory_nodes
WHERE locked_page_allocations_kb > 0;

Change it

-- Windows: Local Security Policy, Local Policies, User Rights Assignment,
-- Lock pages in memory: add the Database Engine service SID, which keeps the grant
-- across service account changes; then restart the instance

No sp_configure here either. Grant the Lock pages in memory right to the service account or its service SID in Local Security Policy, or use SQL Server Configuration Manager (SQL Server 2019 and later), then restart the instance.

When to change it

Only on Windows servers that have really been paged out: SQL Server working set trims or PAGEIOLATCH bursts while Available MBytes still looks healthy. Set max server memory first, and do not grant it as a routine speedup.

What can go wrong

Locked pages cannot be reclaimed, so without a firm max server memory the instance can lock away RAM until the OS starves and the box hangs. Set the ceiling first and leave the OS and other processes room, and remember a service SID grant survives service account changes, so audit it rather than assume it is fresh.

Questions about locked pages in memory

What is the default value of locked pages in memory in SQL Server?

Not granted. Windows only. sys.dm_os_sys_info.sql_memory_model_desc reports CONVENTIONAL, LOCK_PAGES or LARGE_PAGES (SQL Server 2016 SP1 and later).

Does changing locked pages in memory require a restart?

No. No sp_configure here either. Grant the Lock pages in memory right to the service account or its service SID in Local Security Policy, or use SQL Server Configuration Manager (SQL Server 2019 and later), then restart the instance.

When should I change locked pages in memory?

Only on Windows servers that have really been paged out: SQL Server working set trims or PAGEIOLATCH bursts while Available MBytes still looks healthy. Set max server memory first, and do not grant it as a routine speedup.

Back to all SQL Server settings, or check the SQL Server manual for every option.

// one client for every engine

Check locked pages in memory on your own server

SQLly runs the query above against SQL Server and the other engines in this reference, from one desktop app on macOS, Windows and Linux.

Texte et données de cette page : CC BY 4.0, en citant SQLly (sqlly.app). Code et extraits SQL : MIT. Détails de la licence