Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11276

Performance: Drafts table is missing index for topic_id, contributes to slow move_topic

    XMLWordPrintable

Details

    Description

      When a topic is moved to another forum, move_topic() in functions_admin.php makes this call to update the forum_id of all drafts which are associated with that topic:

      UPDATE phpbb_drafts
      SET forum_id = X
      WHERE topic_id = X;
      

      But the drafts table has no index on topic_id, so every row in the table must be examined:

      # Query_time: 36.469295  Lock_time: 0.000037 Rows_sent: 0  Rows_examined: 93516
      UPDATE phpbb_drafts
      SET forum_id = 17
      WHERE topic_id = '1563997';
      

      A new index on topic_id must be added to serve this efficiently.

      Note that the existing indexes on the drafts table are poorly defined in general, which causes performance issues in other situations as well. Please see this ticket: http://tracker.phpbb.com/browse/PHPBB3-10712

      Attachments

        Issue Links

          Activity

            People

              CHItA CHItA
              thenickdude thenickdude [X] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: