CHAPTER 5 Frequent Insertion Trees

THE PROBLEM IN a nested sets tree with frequent insertions is that the left and right (lft, rgt) pairs have to be adjusted so often that locking the table, changing the rows, and unlocking the table again becomes a major overhead. The nested sets model does not require that the union of the rgt and lft numbers be an unbroken sequence to show nesting. All you need are the condition that (lft < rgt), uniqueness of lft and rgt numbers, and that subordination is represented by containment of one (lft, rgt) pair within the ranges of the other (lft, rgt) pairs. This means that we can put gaps into the initial design of the table and fill them without having to reorganize the table each time. The size of the gaps ...

Get Joe Celko's Trees and Hierarchies in SQL for Smarties now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.