March 4, 2019 by Kenneth Fisher
You’ve heard of tempdb right? It’s one of the system databases. All of the system databases are important but poor tempdb gets beaten on more than any of the others. You almost never type tempdb? And you are querying stuff out of master and msdb all the time? Yep. Tempdb is the silent partner. SQL uses tempdb all the time. So much that Brent Ozar (b/t) compares it to a public restroom.
Ok, tempdb is important. Now you want to know where I’m going with this? There’s a point, I promise.
For this month’s SQL Homework I want you to work on the tempdb configurations. For the most part, this is going to be very similar to modifying any database but there are some pretty significant differences.
- Read up on tempdb.
- What can’t be done? Backups for example.
- Create a temp table and go to tempdb to see what the actual table name is.
- Add a new file.
- Confirm that all of the files are the same size and have the same growth and growth limits.
- Move an existing file from one drive (or directory) to another.
- Remove a file.
- Shut down SQL, delete the tempdb files, bring SQL back up again. What happened?