Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15941

Replace MAX SQL in functions_posting.php

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 3.2.6-RC1
    • 3.2.5
    • ACP, Posting
    • PHP all, MySQL all

      In large phpBB installs, the query beginning on line 205 of includes/functions_posting.php

      Takes a very, very long time - upwards of 10 min. I'm testing this on a site with ~24 million posts. Adding a compound key of (forum_id,topic_id,post_visibility) to the posts table get the query down to about 3 seconds. But replacing MAX with ORDER BY p.post_id, LIMIT 1, reduces query time to around 0.5ms on my server.

      This probably isn't an issue for small communities, but with larger databases, it causes the delete post function to always time out.

      I will add PR in github.

            Marc Marc
            soviet9k soviet9k [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: