cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the total size of the files

James_Yang
Champ in-the-making
Champ in-the-making

I use the following query to get the total file size in Tarabytes:

select sum(cast([filesize] as bigint)) /1024.0/1024.0/1024.0/1024.0 from hsi.itemdatapage

The query returns 21 tatabytes.

When I look at the property of the disk drive. The usage of the disk drive for all disk groups shows that only 5 tatabytes have been used. If I modify the query by joining the table hsi.itemdata with status = 0, it would still return 21 tarabytes in total for all the items in hsi.itemdatapage.

Is there a way to get accurate file size in total for the files stored in OnBase?

2 REPLIES 2

Joseph_Liotine
Champ on-the-rise
Champ on-the-rise

If yu have reporting services there is a report thre tht tells you the disp space used by by each disk group.

John_Anderson4
Star Collaborator
Star Collaborator

If you just want the total number of bytes used by all documents in OnBase, this is the query I'd use. One limitation is if you have revisionable documents this will only look at the latest revision. Otherwise it should be quite accurate.

select sum(cast(sizes.bytes as bigint)) as 'bytes'
from
(
select distinct docdetail.itemnum as 'itemnum', sum(distinct(docdetail.pagesize)) as 'bytes'
    from
    (
        select distinct it.itemnum as 'itemnum', ip.itempagenum as 'pagenum', ip.filesize as 'pagesize'
        from hsi.itemdata it with(nolock)
        inner join hsi.itemdatapage ip with(nolock) on ip.itemnum = it.itemnum
        where ip.docrevnum = it.maxdocrev
    ) docdetail
    group by docdetail.itemnum
) sizes