Attachment query hangs

AndyB

Well-known member
When I run this query in phpmyadmin it hangs.

Code:
SELECT xf_attachment_data.data_id
FROM xf_attachment_data 
LEFT OUTER JOIN xf_attachment ON xf_attachment.data_id = xf_attachment_data.data_id
WHERE xf_attachment.data_id IS NULL

I have over 300,000 attachments but a similar query to check a one-to-one between attachments and posts works fine and returns results in a few seconds.

Could someone run this query in phpmyadmin and verify it works correctly. Perhaps I'm running out of ram or something.
 
Thank you for testing the query, Jake. I knew it should work but the results are never displayed when I run the query in phpmyadmin.

I just want to make sure I don't have any orphaned attachments. I have several scripts that I run for data integrity. In testing scripts like the one I have that converts linked images to attachments, I often end up with orphaned data that I like to clean up.
 
Top Bottom