N
N
neronru2016-11-15 23:16:58
Database
neronru, 2016-11-15 23:16:58

Where is this kind of data stored?

In general, there is a notification system on the site. This system has support for grouping some types of notifications into one if certain conditions are met:

  • They must be neighbors in the list (moreover, the condition may change to group by time or by position (if there are in the latest notifications, within say 10, of the same type, then you can group them) )
  • The number of notifications in a grouping does not exceed a certain number (well, for example, in one grouping, there should be no more than 50 notifications)
  • They must have the same values ​​in the grouping field
  • They must have the same date (grouping only happens if they happened on the same day)

Moreover, the grouping goes from bottom to top, that is, older notifications are grouped first, then new ones.
Now all this is implemented using Redis, but as you know, Redis is not a stable storage, since the data is contained in memory.
It is clear that such logic is very difficult to process in relational DBMS. Especially in MySQL without the use of crutches.
What DBMS is better to use for such a structure?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Shelemetiev, 2016-11-22
@zoroda

PostgreSQL (and ORACLE) are great at this kind of work.
Your query will most likely need standard functions:
- LAG() OVER() to determine the neighbor,
- COUNT() or COUNT() OVER () to determine the number
Everyone, including MySQL, can determine the same values ​​in the specified field and date

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question