SQL Server – Impact of High Worktables/sec and Workfiles/sec on tempdb Contention

sql server

We have a large number of very heavily used OLTP systems. One of our biggest issues right now is tempdb contention. I understand how creating many temp tables and table variables (which our developers love to do) will cause contention on GAM/SGAM/PFS pages, I am curious whether workfiles/worktables will also cause contention on those pages? My brain says yes, but I can't find anything to corroborate that.

The reason I'm concerned is that I don't want to be only tackling the temp table creation issue, but if we also need to get worktables and workfiles under control too.

For example one of our DB's currently has these numbers (slightly off peak):

Temp table Creation Rate: 30/sec

Workfiles / sec: 20000

Worktables / sec: 800

Best Answer

Short answer: yes.

Longer answer: Anything which creates and drops objects from tempdb will cause GAM/SGAM/IAM/PFS/etc. contention and needs to be addressed if possible. Workspaces are creating tables under the covers so they'll cause a lot of the same issues.