[wp-trac] [WordPress Trac] #52999: Decrease the number of SQL queries in the pages list table

WordPress Trac noreply at wordpress.org
Thu Apr 8 11:51:17 UTC 2021


#52999: Decrease the number of SQL queries in the pages list table
----------------------------+-----------------------------
 Reporter:  Chouby          |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:
 Severity:  normal          |   Keywords:
  Focuses:  performance     |
----------------------------+-----------------------------
 In the pages list table,
 {{{WP_Posts_List_Table::_display_rows_hierarchical()}}} first calls
 {{{get_pages()}}}. Then we have the following call stack:
 -> {{{WP_Posts_List_Table::single_row()}}} for all displayed pages
 -> {{{wp_check_post_lock()}}}
 -> {{{get_post_meta()}}}

 The issue is that {{{get_pages()}}} doesn't prime the post meta cache.
 Thus all calls to {{{get_post_meta()}}} create a single SQL query,
 resulting in as many SQL queries as teh number of pages displayed in the
 list.

 I propose to update the post cache before calling
 {{{WP_Posts_List_Table::single_row()}}} to decrease the number of SQL
 queries.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52999>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list