Best method for storing a list of user IDs

后端 未结 2 1635
说谎
说谎 2020-12-15 14:25

I\'m working on a PHP/MySQL rating system right now. For the user to be able to rate the user has to log in. Each user has a unique \"UID\". There will be multiple rating in

2条回答
  •  一向
    一向 (楼主)
    2020-12-15 14:49

    In a normalized database, you should store it in a junction table:

    UserRatings
    -------------
    RatingID int
    UserID int
    UserVote int
    

    I don't know what are your queries. Depending on the application, this might not have the acceptable performance. However, in either case, I suggest you go with the normalized approach, benchmark, and denormalize only if appropriate.

提交回复
热议问题