Forum Discussion

JimmyNeutron's avatar
8 years ago

I need a SQL query to get total count of items on hold and total size

Hi,

Does anyone happen to have a SQL query to collect the total number of items on legal hold and total size?

Per EV database is fine.

 

Regards,

Jaime

 

  • How's this?

    Simple:

     

    --Returns number of items on legal hold and total size of items on legal hold in current Vault Store DB
    SELECT COUNT(DISTINCT hs.SavesetIdentity) AS 'Number of held items', SUM(s.ItemSize) AS 'Size of held items (KB)' FROM HoldSaveset AS hs JOIN Saveset AS s ON s.SavesetIdentity = hs.SavesetIdentity

     

     

     

    More detailed:

    --Returns number of items on legal hold and total size of items on legal hold in current Vault Store DB,
    --broken down by container for further detail
    SELECT ISNULL(av.ArchiveName,'Total for VS') AS 'Container',
        COUNT(DISTINCT hs.SavesetIdentity) AS 'Number of held items',
        SUM(s.ItemSize) AS 'Size of held items (KB)'

    FROM HoldSaveset AS hs
    JOIN Saveset AS s ON s.SavesetIdentity = hs.SavesetIdentity
    JOIN ArchivePoint AS ap ON ap.ArchivePointIdentity = s.ArchivePointIdentity
    JOIN EnterpriseVaultDirectory.dbo.ArchiveView AS av ON av.VaultEntryId = ap.ArchivePointId

    GROUP BY ROLLUP(av.ArchiveName)

     

     

    --Chris

      • TonySterling's avatar
        TonySterling
        Moderator

        ItemSize should be the compressed size as held in EV, I believe.