Best representation of an ordered list in a database?

后端 未结 5 497
礼貌的吻别
礼貌的吻别 2020-11-28 04:08

I know that this sort of goes against the principles of a relational database but let me describe the situation.

I have a page where the user will place a number of

5条回答
  •  死守一世寂寞
    2020-11-28 04:57

    Use the Approach 1 and live with the performance implications of index updates. Unless you are dealing with millions of items per page, you are unlikely to find the performance lacking, and you retain all the power of SQL in dealing with sets of data.

    In addition to being much harder to work with from the pure non-procedural SQL, the Approach 2 would still require you to traverse the list to find the right place to reconnect the "links" when reordering the item.

提交回复
热议问题