Relations in Aerospace

I was wondering how one could represent relationships in Aerospike ? I understand this Key-Value repository, but is there an example that can be given?

For example: If you have a user in the system and I want to get a list of Thing entries associated with this user.

+6
source share
2 answers

A few quick ideas:

1- Each user will have a record (the equivalent of a row for a regular RDBMS) with several mailboxes, each of which has a primary entry key "Thing" in it. You can find more information about the aerospace data model here . This should work well if the number of things related to the user is rather low (usually not more than 100).

2- If you have a large number of "Things" entries for each user, you can use LDT (Big Data Type), such as LLIST .

Hope this helps!

+4
source

One way to store NoSQL key keys is different from the relational way of thinking, because one-two-one relationships can be represented in the same table using lists and maps.

For example, if your user has several credit cards, each of which is a tuple (type of card, last 4 digits of the card, token from the processor representing the card, billing zip code), they may be present as a list of cards. JOINTS between two many-to-one tables exist because RDBMS models atomic data, where in Aerospike this data will be modeled as a complex data type.

+4
source

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


All Articles