3 ms·
What about using linked lists? If the write performance is more of a concern than read performance then it is a possible option too.
by yoz-y 9y ago
What about using linked lists? If the write performance is more of a concern than read performance then it is a possible option too.
- FLUX-YOU 9y agoIt's cheaper to write to the DB when doing ordering updates, but you lose easy 'order by sort_order' in queries since the nodes you're linking to will likely be primary keys that are in a different order than the creation sequence. This probably has index ramifications but I don't know enough about them to say. That's fine if you sort everything on the front end though. It's product-dependent. Like someone else said, usually these kinds of lists are small enough and PCs/databases are fast enough for it to not really matter.
- imhoguy 9y agoRelational table is flat row set and linked list is a directed graph. To traverse arbitrary depth graph stored in a relation one needs to use recursive queries - quite expensive operation. Moreover once the relation data gets filtered (`WHERE`) then some links get broken/lost.