PTT for MySQL Tree Traversal
June 16th, 2004
I’ve been spending a few minutes working on building a query for Pre-Ordered Tree Traversal, or PTT. The library phpGACL uses MPTT, a modified form of PTT.
This approach is really advantageous to writing procedural recursive SQL. Without getting too technical, you basically store some ordering metadata at insert time that allows you to easily query the hierarchy and return an ordered depth path to the location of the desired node.
I posted about this earlier, but I may write additional notes about the algorithm as I gain more understanding and familiarity.
