Database comparison

本文对比了SQL与NoSQL数据库的主要区别,包括数据结构、扩展方式、预定义模式、数据类型、查询语言、ACID属性及CAP定理等。探讨了SQL数据库如MySQL、Oracle与NoSQL数据库如MongoDB、Cassandra的特性,并分析了Redis的高性能内存存储能力。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Database comparison

2018-10-06 THUDM team Eunbi Choi

SQL vs NoSQL
  1. High-level differences

    SQLNoSQL
    Relational databaseNon-relational database
    Table baesdDocument based, key-value pairs, graph databases or wide-column stores
    Scale vertically - Increase the load on a single server.Scale horizontally - Scale across multiple hardwares.
    Pre-defined schemaDynamic schema
    Structured and unchanging dataUnstructured and chainging data
    Language : SQLLanguage : UnQL (syntax varies from database to database)
    Examples : MySql, Oracle, Sqlite, Postgres, MS-SQLExamples : MongoDB, BigTable, Redis, Cassandra, CouchDB, Hbase
    ACID properties (Atomicity, Consistency, Isolation, Durability)Brewer's CAP theorem (Consistency, Availability and Partition tolerance)
    MatureYoung
    Compelx queriesSimple low level queries
  2. Advantage

    SQLNoSQL
    Reliable data protectionFast and high performance
    Privilege and password security systemScalability
    Atomic transactions supportLarege volume data
    Execellent support with developed communityFit for hierarchical data storage
  3. When to use

    SQLNoSQL
    Need to ensure ACID compliancy - For high transactional based applications.Rapid development - Fit for agile development. Don't need to prepare data ahead of time.
MongoDB vs CouchDB

Redis

Redis is simple key-value in memory database with some data structures, therefore it can look up keys and return values very quickly.

According to the below article, Redis only needs 16MB to store one million key-value pairs. Expanding to 300 million keys, the total is just under 5GB.

Redis at Instagram (now switched to Cassandra from Redis): https://instagram-engineering.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c


Data to store
  • room manager's data : id & password

  • room info : room id, manager id, creation date -> memory

  • blacklist : user id -> memory

  • ...

The project's situation
  • There is only one data (room manager's data) to store yet.

  • Simple / small amount / changing data

  • Inexpensive hardware

  • Adopting agile methodology / Rapid development

  • Famililar with SQL and Redis, unfamiliar with NoSQL

Decision: undecided

Deciding between MongoDB and Redis.

Reference

转载于:https://www.cnblogs.com/THUDM/p/9759699.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值