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

view_log() performs unneeded count query over all log entries.

    Details

      Description

      The front page of the MCP calls view_log() in order to fetch the last 5 moderator actions. The final action of view_log() is to perform a COUNT() operation over all of the moderator log entries since the beginning of time. This query is very slow because it has to touch so many rows. On my server it takes 1.5 seconds to count >300,000 moderator log entries and forms a large portion of the time needed to open the MCP front page.

      That total count of moderator log entries is simply thrown away by the MCP - it doesn't use it and doesn't require it. I suggest that mcp_front.php should set $log_count to -1 before it makes the call to view_log(), and that view_log() should avoid fetching the total number of logs if $log_count is equal to -1.

        Issue Links

          Activity

          Hide
          Oleg Oleg [X] (Inactive) added a comment - - edited

          Looks good (by me and igorw).

          Show
          Oleg Oleg [X] (Inactive) added a comment - - edited Looks good (by me and igorw).
          Hide
          naderman Nils Adermann added a comment -

          Why would that query take so long? Isn't this also indicative of a missing index for the pages viewing the log?

          Show
          naderman Nils Adermann added a comment - Why would that query take so long? Isn't this also indicative of a missing index for the pages viewing the log?

            People

            • Assignee:
              nickvergessen Joas Schilling
              Reporter:
              thenickdude thenickdude [X] (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development