如何将现有的关系数据库转换为键值存储? [英] How to convert an existing relational database to a key-value store?
问题描述
我正在尝试将现有的关系数据库映射到键值存储。下面是几个示例表。
I am trying to map a existing relational database to a key value store. Couple of example tables are represented below.
对于一个实例,上面的雇员详细信息表可以在Redis(或任何类似的键值存储)中表示如下
For an instance the above "Employee Details" table can be represented as follows in Redis (or any similiar key-value store)
set emp_details.first_name.01 "John"
set emp_details.last_name.01 "Newman"
set emp_details.address.01 "New York"
set emp_details.first_name.02 "Michael"
set emp_details.last_name.02 "Clarke"
set emp_details.address.02 "Melbourne"
set emp_details.first_name.03 "Steve"
set emp_details.last_name.03 "Smith"
set emp_details.address.03 "Los Angeles"
付款表也可以如上所述表示。但是此方法不能在雇员详细信息表和付款表之间建立一对多关系。因此,有没有更好的方法可以从现有RDBMS中实现键值存储。您可以参考这两个表,并提出一个更好的密钥架构来存储值。
The "Payments" table also can be represented as above. But this method does not build the one-to-many relationship between the "Employee Details" table and the "Payments" table. Therefore, is there any better way of implementing a key-value store from an existing RDBMS. You can refer to these two tables and suggest a better key schema to store values. Thanks in advance.
推荐答案
Nosql数据库基本上是聚合存储。关系及其关联的值存储在键的val设计的值部分。
Nosql databases are basically aggregate stores. Relationships and its associated values are stored in a 'value' part of key - val design.
避免联接有助于提高性能。
Avoiding joins helps in better performance.
关于nosql建模的出色llink-
https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/
Excellent llink on nosql modeling - https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/
这篇关于如何将现有的关系数据库转换为键值存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!