I'm trying to find ways to free up space on my server and I first looked at the internal_data folder since it's so large. I noticed some attachments were repeated: same file_hash, so I downloaded the files and confirmed they are in fact exactly the same image.
Sometimes users post the same image across the forum and it can add up. Is there a reason XF needs to create a new file for the attachment in internal_data if's exactly the same?
I decided to use a SQL query to check how much space could be freed if these all used the same image file, and it's at least 7 GB for my forum. That's a lot of space.
This is the query I used:
It could actually be more than that because I found some additional duplicate images in internal_data that weren't in the xf_attachment_data table for some reason.
Sometimes users post the same image across the forum and it can add up. Is there a reason XF needs to create a new file for the attachment in internal_data if's exactly the same?
I decided to use a SQL query to check how much space could be freed if these all used the same image file, and it's at least 7 GB for my forum. That's a lot of space.
This is the query I used:
SQL:
SELECT SUM(redundant_space)
FROM
(
SELECT file_hash, file_size, COUNT(1), file_size*COUNT(1), file_size*(COUNT(1)-1) AS redundant_space
FROM xf_attachment_data
GROUP BY file_hash, file_size
HAVING COUNT(1) > 1
ORDER BY file_size*COUNT(1) DESC
) attachdata
It could actually be more than that because I found some additional duplicate images in internal_data that weren't in the xf_attachment_data table for some reason.