[wp-trac] [WordPress Trac] #8384: Improving WP hierarchical data structure / Use SQL trees

WordPress Trac wp-trac at lists.automattic.com
Sun Dec 20 04:41:50 UTC 2009


#8384: Improving  WP hierarchical data structure / Use SQL trees
-----------------------------+----------------------------------------------
 Reporter:  hailin           |       Owner:  hailin        
     Type:  feature request  |      Status:  assigned      
 Priority:  low              |   Milestone:  Future Release
Component:  Optimization     |     Version:                
 Severity:  minor            |    Keywords:                
-----------------------------+----------------------------------------------

Comment(by miqrogroove):

 Replying to [comment:3 Denis-de-Bernardy]:
 > it's not easy to maintain such an index without triggers.

 That was my overall impression of this thread.  Reading MPTT made the
 algorithm sound like it had two back-ends; one has the parent-child
 relationships stored in a table, and the other should be maintained as an
 index at the storage layer.  Otherwise, you're potentially locking the
 posts table for a many-row UPDATE command every time you save a new page
 draft.  And is it just my imagination, or do the Left and Right columns
 have to be indexed anyway?  If that's the case, then using sequential Left
 and Right values is a mistake.

 You could take 1 to MAX(Right) and distribute the values, evenly for the
 sake of this example.  If you want to add a value with parent Fruit in the
 original version, you're stuck with (2)Fruit(11) and (7)Yellow(10).  But
 if you had distributed values like (200)Fruit(1100) and (700)Yellow(1000),
 now you can freely insert (1025)Green(1075) without locking the table.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/8384#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list