跳到主要内容
uencoder

NoSQL

NoSQL 是非关系数据库的统称,包括文档、键值、列族、图等模型,为可扩展性与灵活模式而设计。

用途

解决关系数据库在海量数据、灵活模式与水平扩展上的局限。

机制

四大类:文档(MongoDB,JSON 文档)、键值(Redis,简单高效)、列族(Cassandra,宽行稀疏)、图(Neo4j,关系密集)。牺牲部分 ACID 换 BASE 最终一致与水平扩展。无固定 schema(或灵活 schema)。

用例

  • 海量数据水平扩展
  • 灵活/动态 schema
  • 缓存与会话存储
  • 社交图谱与推荐

示例

  • 输入
    db.users.insert({name:"Ada",tags:[...]})
    输出
    No fixed schema

    Document store

常见错误

Assuming NoSQL needs no data modeling
Document structure and indexes still need design

相关词条

参考链接