I made a select query which returned about 20 million rows. Memory usage jumped from 300MB to 3.x GB.
How can I release the additional memory for this database after the query is done, without restarting the SQL process?
I tried:
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
Declare @dbid int = db_ID()
DBCC FLUSHPROCINDB (22)
DBCC FREESYSTEMCACHE ('Comments')
DBCC FREESESSIONCACHE
But it only decreases memory usage by 300MB.