Re: insertion and deletion in the nested set model

From: Christopher Browne <cbbrowne_at_news.hex.net>
Date: 2000/05/25
Message-ID: <V3jX4.127090$VR.2257590_at_news5.giganews.com>#1/1


Centuries ago, Nostradamus foresaw a time when Joe Celko would say:
>
>>> I've read an old post by Joe Celko, explaining the nested set
>model. Seems interesting, but it seams to me that insertion and
>deletion of rows within this model must be pretty hairy (it modifies
>the values of the rgt and lft columns of other rows)... How is this
>handled usually? <<
>
>4) Single node insertion is done with this. The nested set model has
>an implied ordering of siblings which the adjacency list model does
>not. To insert a new node as the rightmost sibling.

[code elided]

It's well and good that it can be implemented with reasonable time complexity.

The _problem_ is not with the time complexity, or with storage complexity, but rather with the human complexity.

Nested set models are _clever_; unfortunately, this means that using them requires a certain degree of "cleverness."

Assuming that DB programmers are clever is unsafe; it's only in Lake Woebegon where "the women are all strong, the men are all handsome, and the children are all above average."

I'd tend to think that actually _using_ nested sets somewhat mandates having some form of "syntactic sugar" to help out.

-- 
cbbrowne_at_acm.org - <http://www.ntlug.org/~cbbrowne/lsf.html>
Rules of the Evil Overlord #92. "If I ever talk to the hero on the
phone, I will not taunt him. Instead I will say this his dogged
perseverance has given me new insight on the futility of my evil ways
and that if he leaves me alone for a few months of quiet contemplation
I will likely return to the path of righteousness. (Heroes are
incredibly gullible in this regard.) <http://www.eviloverlord.com/>
Received on Thu May 25 2000 - 00:00:00 CEST

Original text of this message