Question

Situation

I am trying to figure out a rating system right now that contains ratings for servers by players. A user would be able to rate a server in several different categories. Maintainability, performance, and compactness of the storage of the ratings are what I am trying to find a balance for right now. Hopefully we can come up with some good solutions to this.

MB required = (bytes per entry) x (500 reviews) x (4000 servers) / (1024) / (1024)

Method 1: Maintainable bridge table Allows storing of any number of categories, searching is easy, categories are allowed to have additional attributes as specified in their own table. would require 64 different entries to be equivalent to the holding power of the other methods.

[int Server_ID 4 bytes]

[int Account_ID 4 bytes]

[int rating 2 bytes]

[bigint last_updated 8 bytes]

[int category_id 4 bytes]

Total space required: 2929.7 mb.

enter image description here

Method 2: SET column If storing less than 64 categories, I could have a SET column to act as a bit flag table.

[int Server_ID 4 bytes]

[int Account_ID 4 bytes]

[SET ratings 8 bytes] (probably less)

[bigint last_updated 8 bytes]

Total space required: 45.77mb.

SET method

Method 3: Multiple bit columns I could just use a bunch of different bit columns that have names on them. Maybe use a comment to pull out a description of the category when displaying it in the actual application.

[int Server_ID 4 bytes]

[int Account_ID 4 bytes]

[multiple bit ratings: 8 bytes??? bytes]

[bigint last_updated 8 bytes]

Total space required???: 45.77mb.

enter image description here

Was it helpful?

Solution

Use the bridge table approach if you want to have a wide range of attributes applied to each rating category. The bridge table would be the most maintainable option out of the three. Certainly the easiest for others to understand. If space is no concern, and you do not suspect that the table will grow to 128,000,000 entries, try using a bridge table.

Use the SET approach if you know you will never need over 64 categories, or if data space storage is a high concern.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top