zoukankan      html  css  js  c++  java
  • mysql vs mongodb

    Comments

    MongoDB 是NoSQL 数据库,适合存JSON格式数据,MySQL是关系型数据库,适合存table格式数据

    MongoDB扩展性更好,MySQL支持主从和cluster但是感觉不咋样

    mongodb 没有事务、联表(join)查询的支持,其实有inlook 简单的联表查询支持的

    mongodb 插入更新大量数据比较快,mysql 查询大量相关数据比较快

    MongoDB有很好的HA和恢复支持

    some important quotes:

    • MongoDB is an ideal choice if you have unstructured and/or structured data with the potential for rapid growth while MYSQL is a great choice if you have structured data and need a traditional relational database.
    • In general, a project with frequently updated data will benefit more from a relational database than a nonrelational one. An example of such a project would be any kind of transactional system, like an ecommerce platform, a workflow application, or a payment processor. 

      On the other hand, a project that rarely updates information, such as an analytics application where data doesn't change after it has been collected, will benefit more from a nonrelational database. 

    可以考慮使用 NoSQL (譬如 MongoDB),如果

    1. 想快速啟動小專案測試 idea 
    2. 資料格式不確定 (unstable schema),而未來很有可能調整
    3. 資料之間沒有複雜的關聯、或未來讀取資料時不需要使用 JOIN 的功能
    4. 著重在快速讀取資料與可用性,而非 ACID

    可以考慮使用 RDBMS  (譬如 MySQL),如果

    1. 已經有明確的資料格式,未來不會大幅的變動
    2. 資料之間的關聯很重要
    3. 想要更有效率的讀取資料,未來會大量使用到 JOIN 的功能
    4. 更著重在資料操作的準確性與一致性 (ACID)

    上述的情境主要是在個人專案上,如果實際在業界開發,還需要考量到

    1. 商業邏輯的設計
    2. 目前使用的系統(如何加入,需不需要做調整或轉移)
    3. 部署方式
    4. 成本計算
    5. 維護與營運考量
    6. 未來的擴充性
    MongoDBMYSQL
    MongoDB represents data
    as JSON documents.
    MySQL represents data
    in tables and rows.
    In MongoDB, you don’t need to define the schema. Instead, you just drop in documents don’t even need to have the same fields. MySQL requires you to define your tables and columns before you can store anything, and every row in a table must have the same columns.
    MongoDB has a pre-defined structure that can be defined and adhered to, but also, if you need different documents in a collection, it can have different structures. MySQL uses Structured Query Language (SQL) for database access. You can’t change the schema.
    Supported languages are C++, C Supported languages are C++, C and JavaScript
    Ongoing development is done by MongoDB, Inc. Constant development is done by the Oracle Corporation.
    MongoDB supports built-in replication, sharding, and auto-elections. MySQL supports master-slave replication and master replication.
    If an index is not found, every document within a collection must be scanned to select the documents which offer a match to the query statement. If an index is not defined, then the database engine needs to scan the complete table to find all relevant rows.
    GPL v2/ Commercial license available OD GNU AGPL v3.0/ Commercial licenses available OD
    If most of your services are cloud based MongoDB is the best suited for you. If data security is your priority then MYSQL is the best option for you.
    MongoDB places no restrictions on schema design. MySQL requires you to define your tables and columns before you can store anything. Every row in a table must have the same columns.
    MongoDB uses JavaScript as query language. MySQL uses the Structured Query Language (SQL).
    MongoDB doesn’t support JOIN. MySQL supports JOIN operations.
    It has the ability to handle large unstructured data MySQL is quite slow in comparison to MongoDB while dealing with large databases.
    Real-time analytics, content management, internet of things, mobile apps Structured data with clear schema
    No schema definition required so lesser risk of attack due to design Risk of SQL injection attacks
    An ideal choice if you have unstructured and/or structured data with the potential for rapid growth. A great choice if you have structured data and need a traditional relational database.

    Ref:

    https://www.bmc.com/blogs/mongodb-vs-mysql/#Disadvantages_of_both

    https://blog.panoply.io/mongodb-and-mysql

    https://www.guru99.com/mongodb-vs-mysql.html

    转载请注明出处 http://www.cnblogs.com/mashuai-191/
  • 相关阅读:
    docker部署Nginx
    docker的常用命令
    centos上安装docker
    springcloud负载均衡及Ribbon
    maven下载私服jar
    spring security异常处理的三种方式
    spring security权限控制
    北京理工大学复试上机--2001A
    北京理工大学复试上机--2000
    PAT1067 试密码 (20分)——测试点4分析 一个易错点
  • 原文地址:https://www.cnblogs.com/mashuai-191/p/15246571.html
Copyright © 2011-2022 走看看