How do you mix SQL DB storage and Key-Value (i.e. Redis)

I look through my code and understand that I spend a huge amount of time

  • taking rows from a database,
  • formatting as XML,
  • AJAX GET for the browser and then
  • converting back to a hashed javascript object as my local data store.

In updates, I have to change the process (except for using POST instead of XML.)

Having just looked at Redis, I think I can save a huge amount of time storing objects in the keystore on the server and just use JSON to directly transfer the JS client. But my weak mind cannot foresee that I give up leaving SQL DB (that is, I am afraid to refuse GROUP BY / HAVING queries)

According to my data, I:

  • many, many relationships, i.e. obj tags, obj groups, etc.
  • request objects by a combination of such, i.e. WHERE tag IN ('a', 'b', 'c') AND group in ('x', 'y')
  • self joins i.e. ALL tags for each object WHERE tag = 'a' (sql group_concat ())
  • many external associations, i.e. OUTER JOIN ON rating o.id = rating.obj_id
  • and channels that seem to be a strong point in REDIS

How do you successfully combine key values ​​and SQL databases?

For example, it is advisable to join a large list of obj.Ids from the REDIS set with SQL data using the SQL RANGE query (i.e. WHERE obj.id IN (1,4,6,7,8,34,876,9879), 567, 345 ,...) or vice versa?

Ideas / suggestions are welcome.

+3
source share
3 answers

MongoDB. JSON SQL . Redis , .

+3

, (.. / ), , , ( googling ) -, ,

Googles " XML" ( ), ? , -, /? ?

+2

When you say, "I spend a huge amount of time," do you mean that this is a lot of development time, or do you mean computing time?

Personally, I am afraid to mix the DBMS with a solution other than RDBMS, because this is likely to cause problems when two different paradigms collide.

0
source

Source: https://habr.com/ru/post/1731489/


All Articles