This is a much needed and much overdue blog entry... In 8 Steps to Better Transaction Log throughput, I mentioned a customer that was helped by TWO typical optimization problems I see. In that blog entry, I said I would write two blog entries - that one on transaction log optimization and another on common tempdb optimizations. Well, I forgot...until I was reminded with an email this morning (thanks Marcus!).
First - a bit of understanding of TempDB - what goes there?
OK, so now that you know what goes there - how do you make it optimal?
First and foremost, TempDB is in cache just as any other database is in cache. TempDB does not spill to disk unless you are low on cache and/or if you have a lot of inflight transactions in TempDB. Although TempDB is not persisted from shutdown to restart - it still needs to do some logging and therefore you should consider its optimization a lot like other databases.
Things you should do for TempDB (that are a lot like what you should do for every database):
And - if you need to move TempDB, you should review this KB Article: Moving SQL Server databases to a new location with Detach/Attach
Things you should do SPECIFICALLY for TempDB (especially if you're running on a multiproc machine):
Before I say what... let me tell you why? TempDB has a large number of objects being created all the time. For an object to be created, space must be allocated to it. Space allocation is determined by looking at some of the internal system pages (the GAM, and SGAM). In the end, it is these pages that start to have significant contention (with just one file) in a VERY active TempDB. To minimize that contention you can create multiple files.
BOTH of these last two are described in detail by a KB article: FIX: Concurrency enhancements for the tempdb database.
OK - so that should really help! Moving forward (meaning SQL Server 2005), having multiple files can still help for TempDB.
Theme design by Jelle Druyts
Pick a theme: BlogXP sqlx BlogXP sqlx
Powered by: newtelligence dasBlog 2.0.7226.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Kimberly L. Tripp
E-mail