In an relational database, i have an user table, an category table and an user-category table which do many to many relationship.
What’s the form of this structure in Redis?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With Redis, relationships are typically represented by sets. A set can be used
to represent a one-way relationship, so you need one set per object to
represent a many-to-many relationship.
It is pretty useless to try to compare a relational database model to Redis
data structures. With Redis, everything is stored in a denormalized way. Example:
Once we have this data structure, it is easy to query it using the set algebra: