[wp-trac] [WordPress Trac] #15459: Need Better Page Hierarchy Display Algo

WordPress Trac noreply at wordpress.org
Tue Feb 4 21:57:41 UTC 2014


#15459: Need Better Page Hierarchy Display Algo
-------------------------------+------------------------------------------
 Reporter:  truthmedia         |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Future Release
Component:  Posts, Post Types  |     Version:  3.0.1
 Severity:  normal             |  Resolution:
 Keywords:  has-patch          |     Focuses:  performance, administration
-------------------------------+------------------------------------------

Comment (by McBoof):

 Hi there,

 I'm super interested in this thread as I've got a few clients really
 suffering with 30 second load times with about 5000 hierarchical posts.
 The patch improves this, but it is still pretty slow. Maybe 10 seconds.

 Wouldn't a better algorithm be:
 * Do a normal query (limited by page size) but only return posts with no
 parent
 * Do another query to find all the children of just these top level posts
 * Merge them together

 In the case with a ridiculous hierarchy (say a parent post with 1000s or
 child posts) this won't help too much. But in the cases when each post
 only has a couple of children it'll make a massive difference I think.

 Admittedly things get messy if you're looking at deeper pages (say page
 500 not page 1) of results, but in practice no-one really does this,
 right?

 I guess the real correct way to do this is to store a flattened hierarchy
 table in the database and keep this up to date on post
 create/update/delete, and then query on that.

 Note both Oracle and SQL Server support hierarchy queries easily. MySql
 doesn't, but you could fake it at the database level:
 http://explainextended.com/2009/03/17/hierarchical-queries-in-mysql/

 Just my thoughts. If only I could still code I'd try to do it myself ...
 Jon

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15459#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list