Welcome to MSDN Blogs Sign in | Join | Help

TFS statistics queries

You know how it goes - somehow there's just never enough days in the week to get everything done you want to get done.  A couple of weeks ago I promised to post the queries I use to collecting statistics on our server - and other than feeling bad about it, I haven't done much.

I'm at Tech Ed this week and looking for any excuse to avoid prepping for my presentation on Wed.  If you are at Tech Ed, stop by the VS TLC (Technical Learning Center) Tue morning and say hi.

We'll here they are... but first a few important caveats.

  • These queries use the operational store.  Officially the schema of the operational store is not documented and subject to change at any time.  You should interpret that to mean that it WILL change in the next version and that these queries won't work any more (but by then I'll have new ones :)).  Many of these could be written against the warehouse (a documented, more schema stable store) but since not all of them could, I didn't use it for this).
  • The files/folders query is not the one I used to use.  It is only an approximation as the table it uses can build up some cruft in it over time.  I use this one now because it runs much faster than the precise one and as our file count got above 10,000,000 the old one was just too slow.  In the future we will add scrubbing it to our nightly clean up task and it will be a more accurate reflection of the count.  However, it's probably close enough for our purposes here.  When I first ran it against our server it was only off by 10-20%.

Users with assigned work items:
select count(distinct [System.AssignedTo]) from WorkItemsAreUsed with (nolock)

# of work items:
select count(*) from WorkItemsAreUsed with (nolock)

Work Item versions:
select count(*) from (select [System.Id] from WorkItemsAreUsed with (nolock) union all select [System.Id] from WorkItemsWereUsed with (nolock)) x

Attached files:
select count(*) from WorkItemFiles with (nolock) where FldID = 50

# of queries:
select count(*) from StoredQueries with (nolock)

# of version control users:
select count(*) from tbl_Identity with (nolock) where IsGroupIdentity = 0

# of files(item type != 1)/folders(item type == 1):
select ItemType, count(*) from tbl_VersionedItem group by ItemType

Compresed file size:
select sum(convert(bigint,OffsetTo - OffsetFrom + 1)) from tbl_Content with (nolock)

Uncompress file sizes:
select sum(FileLength) from tbl_File with (nolock)

Total # of checkins:
select max(ChangeSetId) from tbl_ChangeSet with (nolock)

Pending changes:
select count(*) from tbl_PendingChange pc with (nolock) join tbl_Workspace w with (nolock) on pc.WorkspaceId = w.WorkspaceId where w.Type = 0

Workspaces(type != 1)/Shelvesets(type == 1):
select type, count(*) from tbl_Workspace with (nolock) group by type

Local copies
sp_spaceused tbl_LocalVersion

Areas & Iterations:
select count(*) from tbl_nodes with (nolock)

Requests by user:
SELECT sum(ExecutionTime)/1000 AS ExecutionTime, count(*) AS [Count], IdentityName AS [User]
FROM tbl_Command with (nolock)
GROUP BY IdentityName ORDER BY sum(ExecutionTime) DESC

Requests by command:
SELECT sum(ExecutionTime)/1000 AS ExecutionTime, count(*) AS [Count], Application, Command
FROM tbl_Command with (nolock)
GROUP BY Application, Command ORDER BY sum(ExecutionTime) DESC

Brian

Published Monday, June 12, 2006 4:11 PM by bharry

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: TFS statistics queries

Monday, June 12, 2006 9:01 PM by Carl Daniel
Cool, thanks!

# re: TFS statistics queries

Monday, June 19, 2006 7:20 PM by HintonBR
Thanks Brian

# How to measure performance using the web service performance dialog

Monday, September 25, 2006 11:27 AM by Buck Hodges
You may have read about the Team Foundation activity log, which is a database table containing the web...

# Enable logging to troubleshooting Team System issues

Friday, August 24, 2007 11:08 AM by Visual Studio Team System (VSTS) Blog

Here’s a list of how to enable logging for the various client and server components of VIsual Studio

# TFS Statistics update

Sunday, December 02, 2007 12:46 PM by bharry's WebLog

Long ago I published a post on some of the queries I use to monitor data on our internal servers. Someone

# TFS Statistics update

Sunday, December 02, 2007 1:11 PM by Noticias externas

Long ago I published a post on some of the queries I use to monitor data on our internal servers. Someone

# MSDN Blog Postings » TFS Statistics update

Sunday, December 02, 2007 1:20 PM by MSDN Blog Postings » TFS Statistics update

# MSDN Blog Postings » TFS Statistics update

Sunday, December 02, 2007 1:20 PM by MSDN Blog Postings » TFS Statistics update

# TFS 2008 statistics queries

Friday, December 21, 2007 5:24 AM by Denis Pasechnik

Думаю многие читали post в блоге bharry http://blogs.msdn.com/bharry/archive/2006/06/12/628583.aspx описывающий

# TFS Performance & Excel 2007 Heat Map « Grant Holliday

Tuesday, February 26, 2008 6:51 AM by TFS Performance & Excel 2007 Heat Map « Grant Holliday

# re: TFS statistics queries

Wednesday, April 02, 2008 7:35 AM by bang bui

hi Brian,

Does this still work on TFS 2008?

thanks.

bang bui

# re: TFS statistics queries

Monday, April 21, 2008 9:50 AM by bharry

I posted an update here: http://blogs.msdn.com/bharry/archive/2007/12/02/tfs-statistics-update.aspx

Also, there is a tool coming out in the next Power Tools release to do this for you.

Brian

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker