How to Find the Total Amount of Space Used for a Single Space's Attachments

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

As an admin, you may want to find how much space is being used by attachments for a given Space. On this page, we'll explain a database query that can be run to find the total size of attachments, in bytes, per Space.

Solution

The queries below have been tested in MySQL, so they may need to be adapted for other database types.

Confluence 5.8.x and higher

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 select s.spacekey, sum(LONGVAL) FROM contentproperties cp JOIN content c ON cp.contentid = c.contentid JOIN spaces s ON s.spaceid = c.spaceid WHERE c.contenttype = 'ATTACHMENT' AND cp.propertyname = 'FILESIZE' GROUP BY s.spacekey ; 

Confluence 5.7.x and lower

1 2 3 4 5 6 7 8 9 10 11 12 13 SELECT s.spacekey, SUM(filesize) FROM attachments a JOIN content c ON a.pageid = c.contentid JOIN spaces s ON c.spaceid = s.spaceid GROUP BY s.spacekey

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.