Hacker News new | past | comments | ask | show | jobs | submit login

What about using linked lists? If the write performance is more of a concern than read performance then it is a possible option too.



It'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.


Relational 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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: