TempDB Filling Up? Try Resource Governor.


TempDB is one of the banes of my existence.

Anybody, anybody who can query your server can run a denial-of-service attack in a matter of seconds just by filling it up with a simple query:

DROP TABLE IF EXISTS #big_problem; CREATE TABLE #big_problem (filler VARCHAR(8000)); WHILE 1 = 1 INSERT INTO #big_problem SELECT REPLICATE(‘X’, 8000) FROM GENERATE_SERIES(1, 100000);

This while loop will gradually fill up TempDB, and when one of the attempts eventually fails, that’s okay because the session stays open. It’s still using the rest of the space, preventing other folks (and other system tasks) from using it.

You definitely