Long running query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • patracy
    New Member
    • Feb 2006
    • 13
    • 3.5.x

    [Forum] Long running query

    Trying to clear up a few things on the forum. I've switched on the logging for mysql and long running queries. I found this:

    # Time: 160125 21:20:38
    # User@Host: XXXXXXXX[XXXXXXX] @ localhost []
    # Query_time: 30.309812 Lock_time: 0.000044 Rows_sent: 315245 Rows_examined: 558351
    use XXXXXXXXXX;
    SET timestamp=1453778438;
    SELECT a.attachmentid, fd.userid, fd.filedataid, a.userid AS auserid, a.contenttypeid
    FROM filedata AS fd
    LEFT JOIN attachment AS a ON (a.filedataid = fd.filedataid)
    WHERE fd.refcount = 0 AND fd.dateline < 1453774807;
    A little digging and this appears to be from in class_dm_attachment.php. I had found mention about the attachment cleanup in the cron cleanup2.php on a web search. Our forum houses attachments in the file structure, not database. But we have a massive amount of attachments. Any pointers on how to improve this query?

  • Paul M
    Former Lead Developer
    vB.Com & vB.Org
    • Sep 2004
    • 9886

    #2
    For what reason do you want to improve it (even assuming you could) ?
    Baby, I was born this way

    Comment

    • patracy
      New Member
      • Feb 2006
      • 13
      • 3.5.x

      #3
      Just trying to get things in better shape. It seems that if the board isn't very active, and I optimize the filedata table prior to it, it completes in under 10 seconds. We have 50+ gb of attachments. Would this possibly be helped by moving to Innodb instead?

      Comment

      • Paul M
        Former Lead Developer
        vB.Com & vB.Org
        • Sep 2004
        • 9886

        #4
        No Innodb wont really make any difference to it.
        Unless its causing you some issue, Im still not clear why you are concerned about it ?
        Baby, I was born this way

        Comment

        • patracy
          New Member
          • Feb 2006
          • 13
          • 3.5.x

          #5
          Just noticed it causes slowness for users while it's running.

          Comment

          • Paul M
            Former Lead Developer
            vB.Com & vB.Org
            • Sep 2004
            • 9886

            #6
            What version of vB4 are you running ?

            Assuming you have the correct indexes, there isnt really anything you can do with the query, its quite a simple select.

            Baby, I was born this way

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            😀
            😂
            🥰
            😘
            🤢
            😎
            😞
            😡
            👍
            👎