Does "database size" for repository stats = physical size?

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
anotherlab
Posts: 23
Joined: Mon Apr 26, 2004 8:52 am
Location: Albany, NY
Contact:

Does "database size" for repository stats = physical size?

Post by anotherlab » Mon Jan 12, 2009 10:42 am

Does the database size list for the repository stats web page correspond to the actual physical size of the database files? The size of our sgvault.mdf is much larger than the sum of database size values listed for each repository (as listed on the statistics page for the repository). Our database size appears to be increasing by about 10% each month and that doesn't appear to match our development efforts.

Is there any way to query the database to see if there any large files that would balloon up the repository size? I want to rule out the possibility that someone may be versioning large binary files.
Chris Miller
Tyler's VersaTrans Solution

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Does "database size" for repository stats = physical size?

Post by lbauer » Mon Jan 12, 2009 3:25 pm

The database size listed includes file lengths, but does not include the Labels table. Could labels be adding to the size? You can delete un-needed labels to reduce the size of the database. There are other overhead items that contribute to the size of the database that are not included in the repository size.

You might also check your database Properties->Files to see if the Autogrow percentage in increasing the database size more than it needs to.
Linda Bauer
SourceGear
Technical Support Manager

anotherlab
Posts: 23
Joined: Mon Apr 26, 2004 8:52 am
Location: Albany, NY
Contact:

Re: Does "database size" for repository stats = physical size?

Post by anotherlab » Tue Jan 13, 2009 9:45 am

If I add up the values listed as "Database Size:" on the statistics page for each repository, I get roughly 250MB. The size of the sgvault.mdf is about 1.6GB. I don't think the difference comes from the labels.

Is there any way to query the database, either by SQL or by the API, to find the largest files? We have 12 repositories, used by different teams, and it's possible that some may have put binary files in the past and I would like to find files that are not supposed be under version control. Could there be deleted files that could be increasing the size of the database?
Chris Miller
Tyler's VersaTrans Solution

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Does "database size" for repository stats = physical size?

Post by lbauer » Wed Jan 14, 2009 10:12 am

As I mentioned earlier, there are more than files in the database. There's a certain amount of "overhead" with file history, checkout tables, labels, user info, etc. In addition there can be space that has been allocated by SQL Server but not used.

The SQL Server database allocates a chunk of disk space for the .mdf and
the .ldf when it needs room. When it gets to the point that the "free
space" within those files is used up, SQL Server allocates the next
chunk of disk space based on a % or flat MB rate. That's why I suggested you check the
growth rate in your database properties. Also, shrinking the database can release
the unused space.

Meanwhile, here's a query to determine your 100 largest files in the database.

Code: Select all

select top 100 v.objid, i.filelength, n.name from 
sgvault.dbo.tblfsobjectversionfileinfos i
inner join sgvault.dbo.tblfsobjectversions v ON v.objverid = i.objverid
inner join sgvault.dbo.tblfsobjectversionnames n ON v.vernameid = 
n.vernameid
group by v.objid, n.name, i.filelength
order by i.filelength desc
Linda Bauer
SourceGear
Technical Support Manager

anotherlab
Posts: 23
Joined: Mon Apr 26, 2004 8:52 am
Location: Albany, NY
Contact:

Re: Does "database size" for repository stats = physical size?

Post by anotherlab » Wed Jan 14, 2009 10:21 am

Thanks Linda,

That query identified a frightening number of non-source code files that some has added to one of the repository. How can I modify that query to get the repository name and path ($/this/that/) for each row? That would make cleaning up the repositories much simpler.
Chris Miller
Tyler's VersaTrans Solution

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Re: Does "database size" for repository stats = physical size?

Post by jeremy_sg » Wed Jan 14, 2009 11:13 am

I would recommend starting from the NodeCounter power toy, which you can download from:

http://www.sourcegear.com/vault/vaultpowertoys.html

It will tell you which folders currently in your repository have the largest total file size. You can quickly browse through your repository to find the problematic areas.

Secondly, I'm still not convinced that labels are not an issue. Please email support at sourcegear.com ATTN: jeremy with a link to this thread, and I'll send you a SQL query to show you the size of your database tables.
Subscribe to the Fortress/Vault blog

Post Reply