-1

I have a bunch of questions and answers and total votes of those questions and answers. My requirement that I always show how many votes for a question or a answer (and user doesn't often click to who votes for question or answer). Base on this requirement, I have two ways to implement:

  1. store a column name total_vote in question table.
  2. store total vote of a question on memory db such as Redis. Because this data doesn't so important (for example, I can show to user 100 votes, although currently has about 105 votes).

I want to know which is advantages and disadvantages from two above method. I which is prefer due to my business requirement.

Thanks :)

0

Though reads are more common on these votes than writes. From my understanding you always load the vote count together with the question when displaying it. Therefore I would recommend storing them together.

Besides you save money because RAM requirements are lower.

  • Christian

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.