Space used by TFS branches

This seems to be a common enough question to warrant a post. "I am branching a folder with 30gb of content" - how much space will it add to my database. As you might probably already know, a TFS branch creates only new metadata rows for the target paths, hence the size of the files are irrelevant. There is a fixed* space occupied by each item you branch. Below is roughly how the space is broken up: 

TFS 2008

tbl_VersionedItem                          25 bytes
tbl_Namespace                             24 bytes + (avg path length * 2 * 2) bytes
tbl_MergeHistory                           80 bytes
tbl_Version                                   56 bytes + (avg path length * 2 * 3) bytes
Total                                            185 bytes + (avg path length * 10) bytes  

TFS 2010 RTM

tbl_VersionedItem                  8 + (avg path length * 2 * 2) bytes
tbl_MergeHistory                    52 bytes
tbl_Version                             56 bytes + (avg path length * 2 * 3) bytes
Total                                      124 bytes + (avg path length * 10) bytes

 In TFS 2010 - if you have SQL Server 2008 Enterprise edition, we enable compression on the tables with paths in them. In our tests this has shown a ~3x IO saving in large trees. 

Do keep in mind that this doesn't include any transaction log space (or the space used by pending changes)  for creation of the branch.

Cheers,

Chandru

*actually its variable and it mainly depends on how long your paths are - since paths are stored as unicode column, SQLServer needs 2 bytes to store each character in the path