|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, February 11, 2013 2:54 PM
Points: 8,
Visits: 160
|
|
I think we have all been in this situation before. Devs fill TEMPDB then say they need more TEMPDB.
Here is my setup: I have a 4 node DW each with about a 1-1.5TB database living on them. My largest table is about 850GB in each. (1,440,695,540 rows, 353,312,408KB data, 510,599,720KB index (lol yea)).
My tempdb is setup like this: 8 5GB data files (so 40GB total tempdb data file space) 1 10GB log file
As a dba here is what I have always maintained: if your query takes more than 10GB of tempdb to run, the query and/or design is flawed. in this case I have given them 40GB data and 10GB log and yet they still manage to fill that from time to time with queries that run for hours. yes, the fill can be a stats issue. In either situation, imo, the solution is NOT to add more tempdb, but to fix the underlying problem w/ the query/stats.
So really discuss this and help chime in with your feedback on whether you think my logic is correct in that my file sizes are adequate and you should fix the root cause, or I should give in and give more tempdb space for what I viewed as flawed logic.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
There are some things that need lots of TempDB space. Let's take that 850MB table of yours, say a query needs 10% of it and needs to sort the results. That requires ~35GB of sort space. That's either in memory or it's in TempDB, I somehow doubt you have 35GB of memory available for a single query to use (that's above and beyond the buffer pool, plan cache and all other caches), so the sort spills to TempDB
CheckDB uses lots of TempDB. Index rebuilds use lots if you're doing sort in TempDB. Snapshot and read committed snapshot isolation levels use TempDB. Triggers use TempDB. Temp tables, table variables, hash joins, spools, sorts all use TempDB.
Before you conclude it's flawed logic and idiot devs, take a look at what queries are using the most TempDB space and investigate why they're using so much.
Personally, I think you're a little low on TempDB. I remember a 1 TB database with 120GB of TempDB space in total, and it used that space.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, February 11, 2013 2:54 PM
Points: 8,
Visits: 160
|
|
All valid and appreciated points.
One quick thing to add on, in 100% of circumstances a stats update solves the issue. We do have regular maint on stats too. We just have a mix of large and small customers in our warehouse so sometimes a scan may occur due to the "tipping point" of data being returned from the table.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
In that case you have queries that are very sensitive to stats inaccuracies and probably need to identify the tables involved and schedule more frequent stats updates on those tables/indexes/stats.
Edit: Or you have queries/procedures susceptible to bad parameter sniffing problems and probably want to identify and fix them.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, February 11, 2013 2:54 PM
Points: 8,
Visits: 160
|
|
| You would love our environment. All these problem queres are "Advanced Search" queries which call a proc which generates and executes dynamic sql. Most of which have tons and tons of joins.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
Nothing wrong with that. Better than trying to do a catch-all type query that can handle any number of optional parameters.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, February 11, 2013 2:54 PM
Points: 8,
Visits: 160
|
|
you kinda sound like my DBEs :)
but no seriously this advanced search thing has an endless number of parameters and generates 100+ line queries that are just ugly. it's like "lets do a 30 table view" situation
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, February 11, 2013 2:54 PM
Points: 8,
Visits: 160
|
|
My tempdb is on solid state in my cx4 array attached to my host w/ 8GB HBAs. Not gonna get much faster than that :)
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, March 22, 2013 11:49 AM
Points: 945,
Visits: 998
|
|
40gb of tempdb isn't a lot (even if it's on SSD). For even a relatively small DW (say, a couple of TB in size), I generally aim for around 10% as tempdb (more if the DW and ETL are sharing the same system -- a couple of large online index rebuilds will blow out tempdb in no time flat).
While I appreciate the sentiments of the DBA saying "oh, the developers don't need that much tempdb", it's actually about getting the data out to the customers in the most expeditious fashion. Sometimes that means just getting on with it and not having to constantly worry about the "best approach"; there's an old saying that "best is the enemy of good enough."
The tempdb is one of those things where you can throw extra space at it to enable getting stuff done easily. Think of it as helping to enable your developers, if you like (and in most cases, developer time is the most precious resource of all).
You still need to keep an eye on what's going on and ensure that there is a process to get the inefficient stuff refactored (otherwise you will need infinite resources and processing power). From what you have described, you already have candidates in mind for that.
My suggestion would be to negotiate with the developers: you give them additional tempdb if they put in place a refactoring process. That way they can still do quick turn-around on data and query delivery, while you can ensure that long term your system doesn't bog down.
|
|
|
|