B
B
brainflow2016-03-23 00:28:49
Python
brainflow, 2016-03-23 00:28:49

Data in postgres counters in redis, how to filter?

Greetings.
The question of how this case is conceptually solved keeps me awake.
The situation is quite typical, the data (for example, a list of movies) is stored in a relational database (for example, postgresql), and statistics / counters in redis (or memcache), what if I want to select the most watched movies (the number of views is in redis) whose name begins with "kill" (the names are stored in postgresql).
How are such cases handled?
By adding a layer like sphinx/elasticsearch or something else?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2016-03-23
@opium

store counters in a relational database, what's the problem?
if you have less than 10 million users a day, even one database instance will pull such a load, why the garden in this case is not very clear, you can simply aggregate likes and views and later put them in the database to insert them less often.

W
wiz, 2016-03-31
@wiz

Embed a counter store in PG and make your queries on it: https://wiki.postgresql.org/wiki/Foreign_data_wrappers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question