2 ms·
> If you’re storing doubly linked lists in a DB you’re doing it wrong. This was my reaction on finding that TFA's key example is a doubly-linked list. I've nev
by denton-scratch 2y ago
> If you’re storing doubly linked lists in a DB you’re doing it wrong.
This was my reaction on finding that TFA's key example is a doubly-linked list. I've never implemented any kind of linked list in a database; nor have I ever come across someone else's schema that involved linked lists. The kinds of operation you do on linked lists (traverse, insert, append, delete) all involve sequences of row accesses that can't be (conveniently?) described in SQL, so they have to be expressed as multiple distinct accesses.
More generally, I'm suspicious of a schema in which a table contains a "foreign" key to itself. Foreign keys are keys to other tables.
I haven't given it any thought; but could there have been a better example? Or is updating a doubly-linked list the best illustration of why SI is dangerous?
- cryptonector 2y agoRelations form graphs, of which lists are a subset. It's very easy to end up with graphs [in SQL] that can be broken as in TFA.