1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Attachment query hangs

Discussion in 'General PHP and MySQL Discussions' started by AndyB, Apr 5, 2013.

  1. AndyB

    AndyB Well-Known Member

    When I run this query in phpmyadmin it hangs.

    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.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Hangs indefinitely?

    It works for me. What are you trying to do?
  3. AndyB

    AndyB Well-Known Member

    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.

Share This Page