Relationships in Aerospike

一曲冷凌霜 提交于 2019-12-05 06:15:08

Couple of quick ideas:

1- Have each user be a record (equivalent of a row for conventional RDBMS) with multiple bins, each bin having the Primary Key of a 'Thing' Record in it. You can find more details about Aerospike's data model here. This should work well if the number of Things associated to a user is fairly low (under 100 typically).

2- If you have a large number of 'Things' record associated per user, you could potentially use an LDT (Large Data Type) like an LLIST.

Hope this helps!

One way NoSQL key-value stores diverge from the relational way of thinking is that many-to-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 of (card type, last 4 digits of the card, the token from the processor representing the card, billing zip code) those can be present as a list of maps. JOINs between two tables representing a many-to-one exist because an RDBMS models atomic data, where in Aerospike that data would be modeled as a complex data type.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!