Saturday, 9 March 2024

In-memory vs Disk based Database Management systems

 

Database systems are classified into two main categories: in-memory and disk-based, based on how they store and manage data.

 

In-memory databases

In-memory database management systems primarily store data in memory and utilize disk for recovery and logging purposes.

 

Examples

H2 Database: H2 is a Java-based open-source relational database management system. It supports both in-memory databases and persistent disk-based databases. H2 offers features such as ACID transactions, SQL support, and compatibility with other database systems. It finds applications in embedded systems, testing environments, and small to medium-sized applications.

 

Apache Derby: Apache Derby is an open-source relational database management system implemented in Java. It supports both in-memory databases and persistent disk-based databases. Derby is fully transactional and supports SQL queries, stored procedures, and triggers. It is commonly used in embedded systems, desktop applications, and small-scale web applications.

 

SAP HANA: SAP HANA is a high-performance in-memory database designed for processing and analyzing data stored in memory instead of traditional disk-based storage. This enables faster data processing and real-time analytics, making it suitable for applications requiring rapid access to large volumes of data, such as enterprise resource planning (ERP), customer relationship management (CRM), and business intelligence (BI) systems.

 

Apache Geode: Apache Geode is an open-source distributed in-memory data management platform offering low-latency, high-throughput data access and processing. It is commonly used for real-time analytics, event processing, and caching in large-scale distributed systems.

 

MemSQL: MemSQL is a high-performance relational in-memory database well-suited for large-scale data analytics and transactional workloads.

 

 

Disk based databases

Disk-based DBMS primarily store most of their data on disk and utilize memory for caching disk contents or as temporary storage.

 

Examples of disk-based database management systems (DBMS) include:

 

MySQL: MySQL is a widely-used open-source relational database management system for web applications and other software. It stores data on disk and offers features such as ACID transactions, SQL support, and scalability.

 

PostgreSQL: PostgreSQL is an open-source object-relational database management system known for its advanced features and reliability. It stores data on disk and supports ACID transactions, SQL queries, stored procedures, and various data types.

 

Oracle Database: Oracle Database is a proprietary relational database management system developed by Oracle Corporation. It stores data on disk and offers features such as high availability, scalability, and advanced security options.

 

Microsoft SQL Server: Microsoft SQL Server is a relational database management system developed by Microsoft. It stores data on disk and provides features such as ACID transactions, SQL support, and integration with other Microsoft products.

 

MongoDB: MongoDB is a document-oriented NoSQL database management system that stores data on disk. It is designed for scalability, flexibility, and high performance, making it suitable for various applications.

 

ArangoDB: ArangoDB is a native multi-model database system supporting key-value, document, and graph data models. It is considered a disk-based database management system as it persistently stores data on disk.

 

Data structures used by in-memory and disk based database management systems

Main memory databases and disk-based databases are different not just because they use different storage methods, but also because they use different data structures to organize and manage data.

 

Data structures used by main memory databases

Hash Tables: These are like quick-access lists used by main memory databases to find data fast.

 

B-Trees: These are special trees used for searching and organizing data in main memory databases. They help to quickly find and change data.

 

Skip Lists: Skip lists are another way to quickly find and change data in main memory databases. They're like smart lists that help organize data efficiently.

 

Arrays and Lists: Main memory databases also use simple structures like arrays and lists to store and manage data easily.

 

Data structures used by disk-based databases

B-Trees: These are like smart trees used by disk-based databases to quickly find data on the disk.

 

Log-Structured Merge Trees (LSM Trees): These are special trees used by disk-based databases to handle lots of new data quickly. They help manage large amounts of data efficiently.

 

Hash Tables with External Chaining: These are like lists used by disk-based databases to organize data on the disk and quickly find what's needed.

 

Sequential Files: Disk-based databases also use simple files to store large amounts of data efficiently.

 

 

In summary

 

a.   Both in-memory and disk-based database systems use the disk, but in-memory databases mostly keep their data in RAM, while disk-based ones store data on the hard disk.

b.   The main issues limiting the growth of in-memory databases are the fact that RAM isn't permanent (meaning it's not always reliable) and the costs involved. Because RAM doesn't hold onto data when the power goes out, problems like software glitches, crashes, hardware breakdowns, or power cuts can cause data loss. Apart from this, RAM can’t hold much data that a hard disk can hold.

c.    Disks are easier to maintain and are much cheaper.

 

                                                  System Design Questions

No comments:

Post a Comment