I
I
Ivan Kondratiev2016-03-22 11:52:52
MySQL
Ivan Kondratiev, 2016-03-22 11:52:52

How to properly migrate table structures to redis?

Tell me how to properly organize the storage structure in redis.
For example, now there is such a table in the mysql database

_________________
| id  |    author   |
-------------------
|  1  |     ivan     |
-------------------

connection
______________________
| id | author_id | text |
-------------------------
| 1  |  1             | bla |

could you tell me how to make such an example in radish? thank.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aboyev, 2016-03-22
@inik23

Alternatively, you can make two sets - authors and publications - to store the keys. And by key, store the content, for example, in json format.

SET author1 '{"name":"ivan"}'
SET publication1 '{"author_id":"author1","text":"bla"}'
SADD authors 'author1'
SADD publications_author1 'publication1'

You need to understand that you certainly lose performance when de-normalizing a relational database, but if the data volumes are small, then this may be acceptable.

I
Ivan, 2016-03-22
@LiguidCool

What prevents to use a muscle from a node?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question