An in-memory database is a database management system that uses a computer’s memory as a data store. An In-Memory Database is a type of analytical database, which is a read-only system that stores historical data about indicators for business intelligence/business analytics (BI/BA) applications, usually as part of a data store or data mart. These systems enable users to run queries and reports on the information contained, which is updated regularly to incorporate recent transaction data from an organization’s operating systems.
The traditional database management systems use hard disk drives as a data store. A computer’s memory provides much faster access speeds than hard drives, and also the access to algorithms are simpler. As a result, in-memory databases are much faster and their access times are more predictable than those of disk-access. However, memory is much more expensive than disk space, so the individual computer usually has much less of it. However, if a database needs high storage capacity, grid computing can overcome this barrier for in-memory databases.
Because in-memory databases store their data in volatile memory, which it loses in the event of system crashes, they do not easily meet the requirement for persistent storage (persistence) of completed transactions. Many in-memory databases help this and achieve less or more persistence in data storage using the following methods:
- Snapshot files store the state of the database at specific times, such as at scheduled intervals or when the database is controlled to shut down. However, all changes since the most recent snapshot may still be lost in this process.
- Additional log files also reflect recent changes to the database. The most recent snapshot and the log of the changes that have been made in the meantime can be used to automatically restore the last valid state of the database.
- Use of non-volatile RAM, usually realized as a combination of conventional volatile RAM with energy storage, guarantees the receipt of the data even when the system is restarted.
- Highly available In-memory databases ensure durability by replicating and failover to a traditional database.
Some in-memory databases can make parts of the data more or less persistent if desired. This saves you the hassle of backing up data that is easy to recover or that is useless after a system crash.
There are a number of commercial and open source implementations of in-memory databases. These include, Apache Derby, Apache Ignite, IBM Informix, SAP HANA, MySQL (cluster server for a distributed in-memory database) etc.
Hybrid In-Memory Databases
Hybrid in-memory databases are database systems that can store data in both memory and hard drives. These make it possible to achieve the appropriate balance between performance, cost, durability and form factor during operation.
Final Words on In-Memory Databases
The term in-memory database is not very clear. Traditional databases also typically use memory to avoid slow IO access, such as to a hard drive. Depending on the configuration of the system, the entire database can also be kept in memory. Furthermore, for the speed of a database system, the data or index structure is usually more important than the access speed of the storage medium. Only optimizing these data structures to memory without structures for IO access is a difference from traditional databases.
High speeds in in-memory databases are partly due to limiting persistence and consistency capabilities. This is legitimate for databases primarily intended for reading access, but problematic for other use cases. To compensate for these problems, some products such as Redis and MySQL are also often combined, and in-memory databases then serve the purpose of a cache.