Y
Y
Yuri2014-06-28 07:03:52
MySQL
Yuri, 2014-06-28 07:03:52

How to organize the storage of likes in a relational database?

The question is probably hackneyed, but I did not find any sensibly described methods.
The task is simple : store user likes in a relational database, for example in MySQL. There is an entity, the user licks it, we save the fact of like. The simplest scheme: user id and entity id. The presence of such a connection means the fact of a like.
Conditions :
- frequent access and search for likes (for example, show an indicator - did the user like the entity);
– a selection of likes for a user/entity;
– there are a lot of records of likes and they are growing exponentially.
One option is to use caching tools like Redis. But again, I'm interested in the ways of linking Redis + MySql and the correct organization of interaction.
I would be happy for tips on literature or articles (can be foreign ones), with a description of how this is implemented in well-known services.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
theaidem, 2014-06-28
@theaidem

Classmates, for example, dump likes in Cassandra

1
1Michael1, 2014-08-26
@1Michael1

how about using multiple views to select results? (mainly collection aggregation)
I would not recommend displaying all users who liked the entity, but displaying, say, the last 5-10 (if any). view can freely solve this problem
in the same way, as an option, you can slightly denormalize the data on the number of likes for the entity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question