Created On:  29 November 2010

Problem:

The StarTeam Cross Platform Client doesn't have an option to show the size of a project. Is there a way to find out the size of each project?

Resolution:

The following SQL statement can be executed against a SQL Server database to extract the size of each Star Team Project.

-- Change to match the name of the StarTeam Database
USE DataBaseName

SELECT
    p.Name AS [Project Name],
    v.name AS [view],
SUM
    (f.filesize) AS [Total File Size],
COUNT
    (f.projectid) AS [Total Files]
FROM 
   syn_File f, syn_project p, syn_view v, syn_viewmember vm
WHERE
  -- Uncomment line below to execute query for a specific project
  --p.name = 'ProjectName' and
  p.id = f.projectid and
  v.id = f.viewid and
  -- addition - ignore shares
  f.viewid = vm.viewid and
  -- end addition
  vm.rootobjectid = f.id and
  (vm.classid = (select id from CTABLES where STNAME='File')) and 
                f.EndModifiedTime = 0  AND                         -- counts 'tip' revisions only
                vm.endmodifiedtime = 0 AND                         -- make sure unique view member also 
                (f.DeletedTime = 0  AND f.DeletedUserID = -1) AND  -- make sure it is not marked as 'deleted'
                (p.DeletedTime = 0  AND p.DeletedUserID = -1) AND 
                (v.DeletedTime = 0  AND v.DeletedUserID = -1) AND
                (vm.DeletedTime = 0 AND vm.DeletedUserID = -1)

-- ****
-- include and modify the project name in the following line to get ROOT VIEW of project ONLY
-- AND v.id = (select id from syn_view where projectid = (select id from syn_project where name = '2467323') and parentviewid = -1)
-- ONLY use following if querying for a specific project and you have uncommented the line p.name='xxx' above...
--AND v.id = (select id from syn_view where projectid = (select id from syn_project where name = p.name) and parentviewid = -1)
-- ****

GROUP BY p.name, v.name
ORDER BY [Total File Size] DESC, p.name, v.name

Query Output

 Project Name  View Name  Total File Size Total Files 
 Project1  ViewName1  30720604077  220141
 Project2  ViewName2  34553456  12367
 Project3  ViewName3  65743233  5467867








Incident #2482185