The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to find duplicate attachments for my Confluence instance?

Jenin C M
July 17, 2011

Hi,

Could you please suggest how could I find all the duplicate attachments within my Confluence instance?

any specific SQL query to search it in database, as my query results includes versions also.

Thanks and Regards,

Jenin C M

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
HuseinA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 17, 2011

To exclude versions - get the latest version only, you should append prevver IS NULL in your WHERE statement.

If you could provide your SQL query, that would be easier for us to help tweaking it. :)

0 votes
Jenin C M
July 19, 2011

Hi Husein,

Thanks for your response!!

The query I am trying to fetch the duplicate attachments is:

select distinct title, pageid from attachments where attachmentid in (select distinct(a.attachmentid) from attachments a inner join attachments b on a.title = b.title and a.filesize=b.filesize and a.pageid=b.pageid where a.attachmentid <> b.attachmentid);

This query is generating a very large list of attachments (it includes all the versions) but I need only duplicated attachments i.e same pageid, filesize, content but different attachmentid.

Your response will be much appreciated.

Regards,

Jenin

 

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 19, 2011

You just want to add "count(*) as Kount", group by title, filesize, and "having kount > 0"

TAGS
AUG Leaders

Atlassian Community Events