Boaz, on 20 September 2012 - 02:50 PM, said:
Similar to the curiosity raised in this comment on this thread, I'd also be happy to know why there is the 'root' and 'level' columns in the schema. AFAIK, they are not strictly needed in nested set implementation. Is that for performance enhancement?
I've looked at the couple of resources linked in the mentioned comment: the first is a 404 now and the second doesn't answer the question as well (though I've skimmed it).
Thanks!
Boaz.
Replying on my own post for the sake of others after getting half the answer here:
'root' column is a sort of foreign key, but to the same table, and it is used to relate the record to its root record in the tree represented in the relational table.
My thoughts: probably for performance reasons, avoiding traversing the entire tree with multiple queries, in case it is desired and all we have in our hands is a leaf down its structure.