How to Determine the Number of Attachments in My Confluence Instance
How to Find the Number of Attachments in Confluence
DB level count:
To query the database for attachments, run this SQL:
Atlassian Support Offerings
The following SQL query is outside the scope of Atlassian Support Offerings and is provided for general guidance only.
-- To get the number of attachments in a space
select count(*) as "number of attachments", SPACES.SPACENAME from CONTENT
join SPACES on CONTENT.SPACEID = SPACES.SPACEID
where contenttype='ATTACHMENT' and spacename='<insert spacename here>'
and prevver is null
and content_status='current'
group by SPACES.SPACENAME
For Confluence 5.7 and above
-- To get a count of current attachment versions only
select count(*) from content where contenttype = 'ATTACHMENT' and prevver is null;
-- To get a count of all attachment versions
select count(*) from content where contenttype = 'ATTACHMENT';
For Confluence 5.6 and below
-- To get a count of current attachment versions only
select count(*) from attachments a join content c on a.pageid = c.contentid where c.prevver is null and a.prevver is null;
-- To get a count of all attachment versions
select count(*) from attachments;
File System count:
For linux
find pathtoattachments -type f | awk -F'/' '{print $(NF-1)}' | wc -l
Last modified on Mar 21, 2024
Powered by Confluence and Scroll Viewport.