r/SQLServer • • 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

30 comments sorted by

•

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.

1

u/ManufacturerSalty148 Aug 13 '26

No extended event out there ? option because there is commvault bakcup runinng i saw it create temp tables and other agent runinng on same vm for sql server so i need to collect whatever consuming space from tempdb

3

u/SQLDevDBA 3 Aug 13 '26

If you must use Extended Events, try Erik Darling’s sp_humanEvents

https://youtube.com/playlist?list=PLt4QZ-7lfQifgpvqsa21WLt-u2tZlyoC_&si=23_WqJeBfJOG9Tlx

1

u/Splatpope Aug 13 '26

Wait what the commvault mssql agent messes with tempdb ?

1

u/ITGuy_cricket Aug 13 '26

Sounds wierd to me too

1

u/ManufacturerSalty148 Aug 14 '26

It's kinda weird, but Commvault was running on an instance, and after a week, I saw tempdb growth go really high. I stopped it for a week, and the growth stopped. Then the backup team asked me to turn it back on and insisted I do it. I saw with one query that it creates temp tables during log backup, which is weird, so I needed a way to record every transaction causing tempdb growth so I could prove it.

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.

1

u/ManufacturerSalty148 Aug 13 '26

No i dont have it enabled 🤷‍♀️🤦‍♀️

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/ManufacturerSalty148 Aug 14 '26

Exactly, but it seems there's no good way to track growth with truncation related to it.

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/ManufacturerSalty148 Aug 17 '26

The application connected to the SQL server, a no-code application, has had low tempdb usage for a long time. It was only after I noticed Commvault creating tempdb objects during each log backup that I started wondering why. I just want to catch it.

1

u/MonkeyDDataHQ Aug 17 '26

So check the DMVs and the temp growth events. Those are part of the default trace.

1

u/Hot_Skill Aug 16 '26

The default trace has a details that is causing the Tempdb growth.

1

u/ManufacturerSalty148 Aug 17 '26

I had not considered this before; I appreciate you bringing it to my attention.

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….

1

u/ManufacturerSalty148 Aug 17 '26

My company's policy doesn't allow open-source applications, which is a bummer because Darling data performance monitor would really help me out.

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/

2

u/Zagnut042 Aug 20 '26

It took me many years and a conference he was presenting at to learn his name was not "Dave". I still giggle to myself every time I hit his blog.

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/ManufacturerSalty148 Aug 14 '26

Its full in always on , i am suspecting commvault has bug that increase tempdb so i want to record every tmpedb growth with query and query plan or query plan id i didnt find good extended events that can do that

-1

u/coffeDrinkerDave Aug 13 '26

Reindexation in tempdb?

1

u/ManufacturerSalty148 Aug 13 '26

No we dont do it