14 Difference Between RDBMS And MongoDB

SHARE

What Is RDBMS (Relational Database Management System)?

 RDBMS is a software system which is used to store only data which need to be stored in the form of tables. RDBMS is an advanced version of DBMS system. In this system, data is managed and stored in rows and columns which is known as tuples and attributes. This makes it easy to locate and access specific values within the database. It is ‘’relational’’ because the values are related to other tables. Popular RDBMS include DB2, Oracle, Microsoft SQL Server, MySQL, PostGreSQL, MariaDB and SQLite

What You Need To Know About RDBMS

  1. RDBMS is a relational database management system and works on relational database.
  2. RDBMS uses SQL to query database.
  3. RDBMS is vertically scalable. Performance increases with increase of Random Access Memory (RAM).
  4. RDBMS emphasizes ACID properties (Atomicity, Consistency, Isolation and Durability).
  5. RDBMS is slower in processing large hierarchical data.
  6. RDBMS supports complex joins, which can be difficult to understand and take too much time to execute.
  7. In RDBMS, you need to first design your tables, data structure, relations and only then can you start coding.
  8. It is difficult to store hierarchical data in RDBMS.
  9. In RDBMS, database uses ROW and COLUMN.
  10. RDBMS does not provide JavaScript based client to query database.
  11. Schema requires to be defined in RDBMS before using a database.
  12. RDBMS is vulnerable to SQL injection attack.
  13. RDBMS supports foreign key.
  14. RDBMS is not that very easy to set up.

What Is MongoDB?

MongoDB is a document-oriented database. This means that it doesn’t use tables and rows to store its data, but instead collections of JSON-like documents. These documents support embedded fields, therefore related data can be stored within them. MongoDB is also a schema-less database, therefore we do not need to specify the number or type of columns before inserting our data.

MongoDB came into the scene around the mid-2000s. it falls under the category of NoSQL and is used for high volume data storage.

What You Need To Know About MongoDB

  1. MongoDB is a non-relational document oriented database management system and works on document based database.
  2. MongoDB uses BSON to query database.
  3. MongoDB is horizontally scalable. Its performance increases with addition of processor.
  4. MongoDB emphasizes on the CAP theorem (Consistency, Availability and Partition tolerance).
  5. MongoDB is amazingly fast in processing large hierarchical data.
  6. There is no support for complex joins in MongoDB. But you can change your document structure and embed the other document inside the first document. But keep in mind that MongoDB has a maximum document size of 16MB.
  7. MongoDB is schema-less. It is a document database in which one collection holds different documents. Therefore you start coding without worrying about tables.
  8. MongoDB has inbuilt support for hierarchical data storage.
  9. In MongoDB, database uses DOCUMENT and FIELD.
  10. MongoDB provides JavaScript based client to query database.
  11. Schema can be dynamically created and accessed in MongoDB.
  12. In MongoDB, SQL injection attack is not possible.
  13. MongoDB does not offer support for foreign key. However, if you require this type of constraint, you have to handle it in the code itself which is somehow complex.
  14. MongoDB is a Java client and thus comparatively easy to set up and get it running.

Also Read: Difference Between OLTP And OLAP Databases

Difference Between RDBMS And MongoDB In Tabular Form

BASIS OF COMPARISON RDBMS MONGODB
Definition  RDBMS is a relational database management system and works on relational database.   MongoDB is a non-relational document oriented database management system and works on document based database.  
Query Database It uses SQL to query database.   It uses BSON to query database.  
Scalability It is vertically scalable. Performance increases with increase of Random Access Memory (RAM).   It is horizontally scalable. Its performance increases with addition of processor.  
Attributes It emphasizes ACID properties (Atomicity, Consistency, Isolation and Durability).   It emphasizes on the CAP theorem (Consistency, Availability and Partition tolerance).  
Processing Speed It is slower in processing large hierarchical data.   It is amazingly fast in processing large hierarchical data.  
Support For Complex Joins It supports complex joins, which can be difficult to understand and take too much time to execute.   There is no support for complex joins in MongoDB.
Creation Process In RDBMS, you need to first design your tables, data structure, relations and only then can you start coding.   It is schema-less. It is a document database in which one collection holds different documents. Therefore you start coding without worrying about tables.  
Storage of Hierarchical Data It is difficult to store hierarchical data in RDBMS.   MongoDB has inbuilt support for hierarchical data storage.  
Database Database uses ROW and COLUMN.   Database uses DOCUMENT and FIELD.  
JavaScript based client Support It does not provide JavaScript based client to query database.   It provides JavaScript based client to query database.  
Schema Schema requires to be defined in RDBMS before using a database.   Schema can be dynamically created and accessed in MongoDB.  
SQL Injection Attack Vulnerable to SQL injection attack.   SQL injection attack is not possible.  
Foreign Support It supports foreign key.   It does not offer support for foreign key.  
Setup Process It is not that very easy to set up.   It is Java client and thus comparatively easy to set up and get it running.  

Also Read: Difference Between Normalization And Denormalization In SQL

Advantages Of MongoDB

  • Structure of a single object is clear.
  • No complex joins
  • MongoDB has features that help to increase data availability
  • It easier to setup MongoDB than RDBMS
  • Conversion of application objects to database objects not required.
  • It is easy to scale-out. When you have to handle a large data, you can distribute it to several machines.

Disadvantages Of MongoDB

  • MongoDB does not support joins like a relational database.
  • There is usually an increasing unnecessary usage of memory due to redundancy.
  • You cannot perform nesting of documents in MongoDB for more than 100 levels.
  • There is no default transaction support and therefore you need to handle it yourself.
  • Joins on data are not supported.
  • Certain operations results in a full database lock leading to concurrency issues.

Also Read: Difference Between INNODB And MyISAM

Advantages Of RDBMS Over MongoDB

  • It offers better physical data independence i.e data can be viewed in different ways by the different users.
  • It provides better backup and recovery.
  • It offers better data integrity.
  • Provides multiple interfaces
  • It ensures that the rows that re-link with other tables cannot be deleted.

Disadvantages Of RDBMS

  • It is difficult to recover the lost data.
  • It is expensive to setup.
  • It can become complex as the amount of data grows.

Also Read: Difference Between DBMS And RDBMS

Comments are closed.