Say we have some poorly written SQL that does not release temp tables when done, or well written SQL that gets killed after it creates temp tables but before it drops them.
Could this result in a SQL Server instance sucking up a lot of memory and not releasing it? How would I reclaim this memory?
a temp table will be dropped after it gets out of scope…and I am talking about a local temp table here not a global one (with 2 pound signs)
SQL Server will always suck up a lot of memory, it will put as much data in cache as possible, getting data from RAM is 1000 times faster than getting data from disk
Run this in SSMS
Now close that window in SSMS
run this in another window
Is the table still there?
If the table is created in a proc, it is not there when the proc is done
Run proc
Now run this, table is not there