Performance issue with Views query plugin(getCountOptimized is never set to TRUE)

Created on 7 May 2020, over 4 years ago
Updated 7 April 2023, over 1 year ago

Problem/Motivation

Performance issue with Views query plugin.

The Views getCountOptimized is never set to TRUE. Every view creates two queries, the 'query' and the 'count_query'. The 'query' is created first, then the 'count_query'. In the first pass while creating the 'query', 'get_count' is FALSE, and thus it sets 'getCountOptimized' to FALSE. On the second pass while creating the 'count_query', 'getCountOptimized' is already set, so it's not recalculated. Had it been recalculated, it would have been set to TRUE on the second pass.

This code goes all the way back to where the 7.x-3.x branch was added in https://git.drupalcode.org/project/drupal/-/commit/a626abb24faa51ac140f7.... This may have been broken for a long time.

Proposed resolution

Views getCountOptimized is never set to TRUE, use local variables instead of global

Remaining tasks

Need Automated Testing

User interface changes

API changes

Yes

Data model changes

Nil

🐛 Bug report
Status

Needs work

Version

9.5

Component
Views 

Last updated about 4 hours ago

Created by

🇺🇸United States douggreen Winchester, VA

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

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

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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