开发者

What is the best friend list table design?

开发者 https://www.devze.com 2022-12-18 12:00 出处:网络
What is the best friend-list table design (for performance)? Probably there should not be many rows for every friendship. W开发者_开发知识库hat Facebook and Myspace is doing? (in MySQL)Assuming you ha

What is the best friend-list table design (for performance)? Probably there should not be many rows for every friendship. W开发者_开发知识库hat Facebook and Myspace is doing? (in MySQL)


Assuming you have a separate users table, it would just be a table where each row has two user ids (e.g., user, friend) and possibly a third column to indicate the strength of the relationship (BFF, acquaintances, etc). You can add unique constraints to make sure you don't have duplicates where the same pair is saved as (user, friend) and (friend, user).

0

精彩评论

暂无评论...
验证码 换一张
取 消