Infrastructure Monitoring with InfluxDB | Live Demonstration

Watch Now

Real-Time Database

Today, a real-time database can mean different things. This glossary page considers two categories of real-time databases.

What is a real-time database?

Today, a real-time database can mean different things. This glossary page considers two categories of real-time databases.

The first kind of real-time database is any database (DB) system capable of processing a stream of data in real-time. This means the real-time database system can store data as soon as they are created. Several database management solutions meet this specification. For example, a time series database is capable of processing real-time data from APIs or sensors.

The second category of a real-time database is a system that makes it easy to store and sync data in real-time. Usually, this type of database solution provides SDKs and APIs that notify clients of changes to the database values in real time. Some examples of databases in this category include FireStore and RethinkDB.

Relational database vs. real-time database

A traditional relational database management system (RDBMS) provides a means for reading/writing data stored in relational tables. The user chooses how to read or write data to and from an RDBMS, based on their implementation’s requirement. For example, a user can insert a new row into a table immediately after an API call, or the user can insert data in a batch.

A real-time database, on the other hand, supports real-time processing of data as soon as the data is created. The clients that depend on the data get the latest version of the data in real time. Most modern real-time database implementations use a NoSQL mechanism to store data. NoSQL is like the direct opposite of SQL, which drives relational databases.

Examples of real-time database systems

The following modern database solutions can be considered real-time databases due to their ability to write and sync data in real-time:

  1. In-memory database: In-memory databases, just like the name states, store data in the memory of an application as opposed to on a disk or file system. In-memory databases access the system’s main memory and are significantly faster than read and write access to disks and file systems. However, an in-memory DB loses stored data the moment the application is terminated or the system restarts. An in-memory DB is ideal for storing data that changes fast and requires real-time access, like live dashboards, e-commerce bidding systems, and caching. Some examples of in-memory DB include H2, Apache Ignite, and Redis.

  2. Time series database: Time series databases usually store data that have a timestamp field. They are ideal for storing data from IoT devices in real time. One option for implementing a time series database is InfluxDB.

  3. Firestore: Firestore is a backend-as-a-service database for mobile and web frontend applications. It’s a cloud-based NoSQL database, meaning that Firestore doesn’t store data in tables and rows. Instead, it uses a special structure called a document.

  4. RethinkDB: RethinkDB is an open-source real-time database solution for web application development. It returns data in JSON format for client applications to consume.

  5. Firebase Realtime Database: This is another cloud-hosted NoSQL database, just like Firestore. Firestore claims to offer an improvement on the Firebase Realtime Database. Firebase seems to have dropped Realtime DB as the default database option for their backend-as-a-service solution.

Real-world examples of using real-time databases

A real-time database can solve many real-life problems, ranging from human communication to financial data management. We list some examples of their use below.

Financial applications

A real-time database can power financial applications that require updating the state of users’ accounts in real-time. For example, financial applications need to immediately update the available balance in a user’s account after a deposit or debit.

Internet of Things (IoT) solutions

Another practical application of real-time databases is in IoT solutions. Here, a real-time database stores values from different components, like sensors, as soon as new readings become available. In some IoT solutions, a value in a database can trigger a device to turn on or off. As a result, speed is very important here, and a good real-time database system reduces the lag in the timing of the IoT device.

Analytic tools

Real-time databases also make live analytics and metrics possible. Storing the data reported by an analytic dashboard in real-time makes it possible to have live reporting. Take for example, a system that tracks the total number of visitors on your website at any given time. A database solution that can report this data immediately will provide more accurate reports at any given moment.

Instant messaging services

A real-time database can also power notification systems. For example, a database that stores new messages in real-time can enable an application to notify users as soon as they receive a new message. Real-time database systems power most of the popular messaging and social media applications we love.

Tools for real-time remote collaboration

Real-time databases can drive applications for remote collaboration. In today’s world, more people work from home and from different parts of the world, and applications for editing documents, spreadsheets, and even presentations now need to sync data in real time for multiple users.

Caching

A key use of caching is to speed up applications by reducing unnecessary access to slower remote data sources. We can use an in-memory database solution to speed up applications by caching data.

FAQs

Is SQL a real-time database?

SQL on its own is not a real-time database; it’s a special standard for querying (reading/writing/processing) relational database systems. Most SQL databases can write data as soon as a query to do so executes. However, in order to keep data from an SQL database in sync with your application, you may need to write extra code. For this reason, SQL itself is not a real-time database, but some modern SQL databases can support real-time writing and reading of data.

Is MySQL a real-time database?

MySQL can store data in real-time and you can implement your application to keep data synced in near real-time while using a MySQL database. However, out of the box, MySQL varies in terms of functionality when compared to most of the real-time databases we considered earlier. For example, in contrast to a database system like Firestore, MySQL does not provide libraries and APIs that help client applications sync data once a change occurs in the database.

What is the best open-source real-time database?

There are several open-source options for real-time databases with different approaches and features to help users to store and retrieve data in real-time. As a result, determining which is best may be subjective based on what you need to build. Examples of popular open-source real-time databases include RethinkDB and Supabase.

Take charge of your operations and lower storage costs by 90%

Get Started for Free Run a Proof of Concept

No credit card required.

quote-shape

Related resources


DBU logo

Free InfluxDB Training

Jump start your InfluxDB journey with free self-paced & instructor-led training.

dbu-illustration