How to find the total size of Attachments per space
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
If you are trying to identify where the majority of your attachments are located by space, this can be helpful when trying to audit attachments to reduce the size of a space export or even a backup with attachments.
Solution
Run SQL query on the Confluence database:
1
2
3
4
select sum(cp.LONGVAL), s.spacename from spaces s INNER JOIN
content c ON c.spaceid = s.spaceid INNER JOIN contentproperties cp
ON cp.contentid = c.contentid where c.contenttype = 'ATTACHMENT' and
cp.propertyname = 'FILESIZE' GROUP BY s.spacename;
The number returned is in bytes.
Updated on April 2, 2025
Was this helpful?
Still need help?
The Atlassian Community is here for you.