[wp-trac] [WordPress Trac] #41714: wp_list_pages() - horrible performance due to eventual "SELECT *"

WordPress Trac noreply at wordpress.org
Wed Aug 23 16:15:02 UTC 2017


#41714: wp_list_pages() - horrible performance due to eventual "SELECT *"
-------------------------------+-----------------------------
 Reporter:  DavidAnderson      |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 I'm investigating awful performance (MySQL slow queries logged constantly)
 a site which uses a plugin to display a page list.

 The plugin calls wp_list_pages(). wp_list_pages() in turn calls
 get_posts(). And get_posts() ends up making the slow query:

 {{{
 SELECT * FROM wp_posts WHERE (post_type = ‘page’ AND post_status =
 ‘publish’) ORDER BY wp_posts.post_date ASC;
 }}}

 So, all the post_content fields (along with everything else) are being
 requested, just for the purposes of constructing a page list. (The site
 has ~ 1200 pages - and the above call returns 34MB from the MySQL server).

 It looks like either get_posts() needs some more flexibility so that it
 has an option to return only specified fields.

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


More information about the wp-trac mailing list