DEV Community

Cover image for 5 database engines you should know about
Avash_Mitra
Avash_Mitra

Posted on • Updated on

5 database engines you should know about

We will discuss different types of engines, their use cases, pros and cons, and much more.

Database engines, also referred to as storage engines, are software programs that handle CRUD (Create, Read, Update, Delete) operations and disk storage for databases. While some are simple and only manage storage and CRUD, more complex engines offer advanced features like ACID support and transactions. Database systems build their functionalities on top of these engines.

In this discussion, we will explore various types of database engines, their use cases, and their pros and cons, to provide comprehensive insights into the world of database engines.

MyISAM

Written in C, MyISAM was the first database engine for MySQL.

  • ISAM stands for Indexed Sequential Access Method. In this engine every index that we create points to a row. It uses B-tree for indexing.

  • Since every index points to a row, read operations are fast. Even the insert operations are fast because we are appending the new record to the end of the file and we always know where the end of the file is. However, the main issue is with the update and delete operations. When we update/delete existing rows, we change the row size, this changes the offset and all the index pointers need to change. This is expensive.

  • It provides no Transaction support.

  • Database crashes corrupt tables and has to be manually repaired.

  • It only provides table-level locking. If you want isolation you just have to lock the entire table.

InnoDB

It replaced MyISAM as the default database engine of MySQL and MariaDB.

  • In this engine, the B+ tree is used for indexing. Each index points to a primary key and each primary key points to a row. If there is no primary key then the engine makes one for you.

  • It supports transactions and therefore implements ACID features.

  • It also allows row-level locking so you don’t need to lock your entire table. This makes query processing faster.

  • It also introduces a lot of new features like foreign keys, tablespaces, and spatial operations.

SQLite

It was designed by Dwayne Richard Hipp and written in C language

SQLite

It is one of the most widely used embedded databases and is used in web browsers, mobile applications, operating systems, etc.

  • It used B-Tree for indexing.

  • It allows all ACID features

  • It allows table-level locking. It does not need row-level locking because it is usually used locally and there is only a single user.

  • It allows concurrent reads and writes.

LevelDB

It was designed by two Google engineers Jeffery Dean and Sanjay Ghemawat and written in C++ language. It was inspired by Google BigTable.

LevelDB

  • It is not a SQL database. It does not have a relational database model and does not support SQL queries.

  • It used Log-Structured Merge Trees for indexing. It works great for high insert volume. (unlike B tree that may need to rebalance itself after insert which makes insert operations slow)

  • It does not allow transactions.

  • It is single-threaded

  • There are levels of files and as the file grows large, levels are merged.

  • They also support Write Ahead Logs to ensure durability.

RocksDB

It is a fork of Google’s LevelDB and is further developed by Facebook. It is used as MyRocks for MySQL, MariaDB, and Percona. It is also used by MongoRocks for MongoDB.

Similarities with LevelDB

  • It also uses Log structured merge trees

  • It is also key-value pair storage and does not support SQL queries.

New features added to RocksDB

  • It allows transactions.

  • It also used multi-threading to improve performance.

  • Other features include Geospatial indexing, Bloom filters, merge operators, etc.

In conclusion, understanding different types of database engines and their use cases can greatly impact the performance and functionality of your database system. Each engine has its own strengths and weaknesses, making it crucial to choose the right one based on your specific requirements.

  • MyISAM, the first MySQL database engine, provides fast read and insert operations but lacks transaction support and may be prone to table corruption.
  • InnoDB, the default MySQL and MariaDB engine, offers ACID compliance, row-level locking, and advanced features like foreign keys and spatial operations.
  • SQLite, a popular embedded database, is widely used in web browsers, mobile applications, and operating systems, providing ACID features, table-level locking, and support for concurrent reads and writes.
  • LevelDB, inspired by Google's BigTable, is a non-SQL database with Log-Structured Merge Trees for indexing, making it ideal for high insert volume but lacks transaction support and is single-threaded.
  • RocksDB, a fork of LevelDB, adds features like transactions, multi-threading, and geospatial indexing, making it suitable for MySQL, MariaDB, Percona, and MongoDB.

Choosing the right database engine depends on your specific use case, performance requirements, and desired features. It is essential to carefully evaluate and compare different engines to make an informed decision and optimize your database system for efficiency and reliability.

Top comments (0)