SQL Procedure Cache getting wiped out every 60 seconds I have an Azure VM running SQL 2017, deployed around August 2020. Not yet taking a production load. Several databases restored, but no users active yet. Running sp_Blitz I was getting this: &quot;The oldest query in the cache was created at &quot;
So I ran this query every second for several minutes:
select 
datediff(second, min(creation_time), getdate() ) AS [Age seconds], 
count(*) as [Row Count] 
from sys.dm_exec_query_stats


[Age Seconds] would get up to 60, and [Row Count] would get up to
about 30 or 40 max, then it would reset to 0's EVERY MINUTE.

This was going on for several days.
I disabled just about every login except mine, stopped ancillary services (Agent, SSIS, SSRS, etc.) and took user databases off-line. Nothing stopped it.
I see in the log several entries of

&quot;A significant part of sql server process memory has been paged
out...&quot;

Finally a re-start of the service did the trick.
SOMETHING SOMEWHERE was running DBCC FREEPROCCACHE every MINUTE like clockwork.
Has anyone ever encountered this, and if so, what was the resolution?
&quot;A significant part of sql server process memory has been paged out...&quot;

I would start with above message. This message means SQL Server working set memory is paging out process to disk. A widely used workaround is, and since you have SQL Server running on Azure VM, to provide SQL Server service account Locked pages in memory (LPIM) privilege. Please refer to this MS support article . To assign LPIM
To assign the Lock pages in memory user right, follow these steps:


Click Start, click Run, type gpedit.msc, and then click OK.

Note The Group Policy dialog box appears.

Expand Computer Configuration, and then expand Windows Settings.

Expand Security Settings, and then expand Local Policies.

Click User Rights Assignment, and then double-click Lock pages in memory.

In the Local Security Policy Settingdialog box, click Add User or Group.

In the Select Users or Groups dialog box, add the account that has permission to run the Sqlservr.exe file, and then click OK.

Close the Group Policy dialog box.
9.Restart the SQL Server service.