Opened 9 years ago
Closed 9 years ago
#34982 closed enhancement (fixed)
New algorithm for displaying a hierarchical list of post objects in the WP_Posts_List_Table is incomplete
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Posts, Post Types | Keywords: | has-patch commit |
Focuses: | performance | Cc: |
Description
It seems to me that the commit [31730] made to fix #15459 mistakenly left out a small but important part of the proposed patch (https://core.trac.wordpress.org/attachment/ticket/15459/15459.5.diff).
In #15459 a new algorithm was proposed to retrieve from the database only the IDs of the posts and its parents to build the hierarchical list of post objects in the WP_Posts_List_Table. Thus reducing processing time and substantially reducing memory usage on sites with a high number of hierarchical posts.
But the commit didn't included a change in the file src/wp-includes/class-wp.php to add 'fields' to the list of private query vars (see attached patch). Without this change the code is still getting all the data related to all the posts to build the post list table instead of just getting the IDs of the posts and its parents.
Attachments (2)
Change History (13)
#1
@
9 years ago
- Keywords has-patch needs-testing added
- Milestone changed from Awaiting Review to 4.5
- Owner set to johnbillion
- Status changed from new to reviewing
This ticket was mentioned in Slack in #core by jorbin. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#10
@
9 years ago
- Keywords commit added; needs-testing removed
- Status changed from reviewing to accepted
Findings:
- This increases the number of queries on the screen by one, but consequently decreases the memory usage, overall query time, and page processing time.
- The more pages you have on your site the greater the memory and time savings.
- All tests remain passing.
In conclusion, yes, this should have been included as part of [31730].
I spoke with @johnbillion and he asked me to post here the MySQL query to get hierarchical post objects with and without the patch.
Without the patch:
With the patch: