In the materialized path strategy, each node/row has its full path in the tree stored in a column and that path is "materialized" or "derived" from a depth-first traversal to that node. In conjunction with the adjacency list approach this could yield much better results in most situations than a nested set model.
Taking the tree used in the article, the paths would look like (using '/' for path delimiter but you can use whatever you like):
electronics
electronics/televisions
electronics/televisions/tube
electronics/televisions/lcd
electronics/televisions/plasma
electronics/portable electronics
electronics/portable electronics/mp3 players
electronics/portable electronics/mp3 players/flash
electronics/portable electronics/cd players
electronics/portable electronics/2 way radios
Alternatively it would make more sense to base the materialized path off of an immutable field such as the PKey of the record (in the same order as the paths above, from the article): 1
1/2
1/2/4
1/2/5
1/2/6
1/3
1/3/7
1/3/7/10
1/3/8
1/3/9
This has the following advantages: * Node insertion/deletion overhead is low / does not require updating other nodes unlike nested set model
* Query for subnodes is easy: "select * from tree where path like 'electronics/televisions'". To get only direct subnodes add a parent_id specifier.
* Getting the full path for a node is easy: it's built into the node itself
* Node depth is easy: count the number of path "segments"
Downsides: * Moving sub-tree requires updating all sub-node paths
Hope this helps someone!Cheers, -Zach