r/SQLServer • u/ManufacturerSalty148 • Aug 13 '26
Question Tempdb size getting high
Hello all my colleagues
I know this is an old topic, but I still haven't found clear instructions on how to solve this one problem. I have a SQL Server 2017 where tempdb keeps growing to almost 80 GB. I know it's because of temp spills, but I want to collect the queries or sessions causing this tempdb consumption using extended events. I haven't found clear instructions or examples of extended events on any site, and I don't know what to do if I find queries consuming tempdb or what to check in the query plan.
6
Upvotes
•
u/AutoModerator Aug 13 '26
After your question has been solved /u/ManufacturerSalty148, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
11
u/Complete-Fondant-202 Aug 13 '26
Switch on querystore
Leverage Erik Darlings sp_quickiestore which will show you tenmpdb usage on queries.
5
u/ihaxr 2 Aug 13 '26
Do you have read committed snapshot isolation enabled on a database (RCSI)? That would cause long running queries, even if they're select queries, to grow tempdb due to large version store.
2
u/BackgroundHour5533 Aug 14 '26
Read Paul Randal’s postings on his SQLSKILLS website on tempDB and why it grows. It is not based on the size of your database, it’s more related to transactions.
1
u/MonkeyDDataHQ Aug 16 '26
Have you looked at ANY of the DMVs? Brent Ozar's first responder kit? The Query Store?
Why do you even care if tempdb gets to 80GB?
What problem are you trying to solve? 😩
1
u/Hot_Skill Aug 16 '26
The default trace has a details that is causing the Tempdb growth.
1
u/kwellendorff Aug 17 '26
download darling data performance monitor lite. the tempdb dashboard is great for monitoring growth. and it’s somehow free….
3
u/FreedToRoam Aug 13 '26
depends on how big is your database and how big is your largest table that is being queried repeatedly. 80gb might not be excessive ... it all depends
1
u/TheGenericUser0815 1 Aug 14 '26
What this guy writes about SQL Server issues saved my ass several times. Maybe you might want to look at this: https://blog.sqlauthority.com/2018/09/17/sql-server-identifying-query-using-tempdb/
1
u/KickAltruistic7740 Aug 14 '26
Most likely a long running transaction or a SELECT query that needs to copy an entire table before sorting. Sp_WhoIsActive should be enough to monitor in realtime otherwise look at using sp_Blitz or query store
1
u/SonOfSerb Aug 16 '26
It's ok as long as she's not driving.
1
u/CanProfessional766 Aug 17 '26
First thing to check is whether tempdb is actually full or if it just grew to 80 GB and stayed there. SQL Server won’t automatically shrink it after the space is freed. For the queries grab the actual execution plan and look for spill warnings on Sort/Hash operators. That’s usually a good clue. Also check the indexes and statistics for those queries.
1
u/mani_RitzyAI Aug 18 '26
Have you tried just logging Adam Machanics "sp_whoisactive" into a table on short intervals and using that as proof?
0
u/Better-Credit6701 Aug 13 '26
Is it in full or simple? Are you using replication, always on, or log shipping? What is the size of the database in relation to the log file? On virtual hardware or on a 'real' server?
-1
u/coffeDrinkerDave Aug 13 '26
Reindexation in tempdb?