TempDB is a special system database that gets used a LOT behind the scenes, and it needs different configuration than other databases. You’ll learn why it’s a performance bottleneck, why 4-8 data files alleviate the issue, show how to reconfigure an existing SQL Server, and see the pros and cons of different storage options for it.

12 Comments. Leave new

  • Thank you for helping demystify the tempdb!

    I noticed in the server setup documentation y’all wrote, it states to have 1 temp file per logical core. I have boxes that only have 1 logical but higher virtual cores; any advice for configuring these?

    Also, is there a best practice for what size to grow your temp db’s to? I believe you had eight at 1028mb files if I’m not mistaken; where did you come up with 1028mb?

    Reply
    • JLochbaum – I’m not sure what you mean about “1 logical but higher virtual cores” – can you elaborate? A logical processor is exactly the same as a virtual core, but I’m guessing something got lost in translation.

      For initial sizes, I generally start with a total TempDB size at 10-25% of the size of data on the server. For example, if you have 1TB of total databases on the server, it’s not unusual to see 100GB-250GB total TempDB size.

      Reply
  • Sure Brent,

    I mean if I look at system info or use a reporting tool that lists processors, I get returns for physical,logical and total cpu processors. For exp: 1 logical, 1 physical, 4 total so it’s a quad core. I inherited several of these boxes that are dual and quad core but a lot of them don’t have multiple temp files.

    Just wondering if I should leave them alone or, in my example, quarter off the temp file, one for each processor.

    Reply
  • Yeah sorry, I didn’t intend for it to turn into misconfigured VM/cores/sockets conversation 🙁

    Cool, that answers question about temp files; I’ll post on stack exchange about the core debacle. I thought physical+logical would = total BUT I’m seeing 1+1 = 4.

    Anyways, thanks again to both of you.

    Reply
  • If we run the following command: DBCC CHECKDB (‘PrimaryDB’) WITH ESTIMATEONLY, should we size our Temp DB based on this result? I ran this against our primary DB (550 GB) and it told me we need 196 GB to run CHECKDB command. Does this indicate that we should have about 200 GB of Temp DB space? That means we would have Temp DB at about 36% of the database size. Thanks Brent!

    Reply
  • I saw your video that gave a loose recommendation of 25%, although another example seemed to indicate a range between 10% and 25%. I may check out your video, but I’m actually trying to solve an issue. Our current DB is only sized with a 40 GB Temp DB (for a 550 GB User DB) and I think that is too small. We are using 8 separate files for the Temp DB, each sized at 5 GB. They are not set to auto-size, they are fixed at 5 GB. We get the out of space error on Temp DB on occasion.

    Reply
    • OK, cool. If you’re trying to solve a production issue, blog post comments probably aren’t a great solution – that’s where consulting comes in. Hope that’s fair!

      Reply
  • We had a consultant come in a while ago, but they were not able to identify the issue. We obviously did not have the right consultant…oh where oh where can we find the right consultant…? Perhaps in the land of awakened volcanoes…? 😉

    Reply

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.

Menu