Forums performance improvements

Created on 19 May 2007, over 17 years ago
Updated 24 April 2024, 7 months ago

The following functions have poor database performance:

  • forum_get_topics
  • forum_get_forums

The problem is that they restrict by taxonomy terms (one table) and sort by latest updates (another table). This will always result in temp tables and filesorts. The solution is unifying the WHERE criteria and SORT BY criteria into one table. In the case of forum_get_topics, the table is term_node. For forum_get_forums, it's term_data or term_hierarchy.

By putting a latest_change_timestamp (which would contain either the node's latest change timestamp or the latest comment's) into these tables, we can paginate forums without expensive queries. Once paginated, it's okay to do something a bit more expensive with each item.

πŸ“Œ Task
Status

Needs work

Version

1.0

Component

forum.module

Created by

πŸ‡ΊπŸ‡ΈUnited States david strauss San Francisco, CA

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024