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).
精彩评论