In this post, we are going to point out some major differences between Redis and MySQL database, and how to best use them in practices.

MySQL is the most popular open source relational database management system, which was released in 1995, later got acquired and maintained by Oracle.

Redis, or RE-dis, is an open-source in-memory data structure project implementing a distributed, in-memory key-value database with optional durability. It is built and maintained by Redis Labs, with the first release in 2009.  It supports data structures such as strings, hashes, lists, sets, and sorted sets with range queries, bitmaps, hyperloglogs, and geospatial indexes with radius queries.

Features comparison

  Redis MySQL
Primary database model Key-value store Relational DBMS
Data schema Schema free supported
SQL Not supported Supported
Triggers No Yes
Connection methods RESP - REdis Serialization Protocol Proprietary native API
ADO.NET
JDBC
ODBC
Partitioning methods Sharding Horizontal partitioning, sharding with MySQL Cluster or MySQL Fabric
Consistency concepts Strong eventual consistency with CRDTs
Eventual Consistency
Immediate Consistency
Transaction concepts Optimistic locking, atomic execution of commands blocks and scripts ACID
Access control Simple password-based access control Users with fine-grained authorization concept

When to use

Redis will be a better fit for:

  • Non-structured data
  • Simple and quick lookups.
  • Caching layer
  • Improving performance for scalability issues

MySQL performs better when you need:

  • Structured data
  • ACID
  • Heavy transactions and complex lookups.

The biggest advantage of Redis is its in-memory key-value data store. It’s extremely fast and flexible and includes built-in data structures (e.g. Lists, Hashes, Sets, Sorted Sets, Bitmaps, Hyperloglog, and Geospatial Indices) that it can perform some data operations more efficiently than relational databases like MySQL.

On the other hand, Redis can complement and extend other databases in your ecosystem very well. So in comparison with MySQL, Redis doesn’t act like a replacement but an accommodation for the drawbacks of the traditional MySQL architecture:

  1. Read/write speeds of traditional databases are not good enough for session stores.
  2. Modifying an existing schema can be complex, which makes it hard to add new features.
  3. Replacing the legacy database is often expensive and risky.

It’s recommended to use Redis as a frontend layer of the database between MySQL and the application like this:

  • Store application data in MySQL as the system of record.
  • Store temporary data users engage with as the system of engagement. Most use cases are:
    • Caching: Caching helps applications retrieve data quickly and limit the load on the database server.
    • Session Store: Instead of relying on MySQL-like relational databases to persist session data, a single cluster of Redis on decently sized servers with sufficient RAM can manage thousands of sessions.
    • Real-time Analytics: Gamification through leaderboards, dashboards, polls, messages, counters and other real-time aggregators require constant processing and communication with end-users.
    • Metering: Redis can also help developers cost-effectively manage the load on legacy servers during peak usage times by rate limiting the number of calls applications make every few seconds.

So, in short, Redis helps you access your data faster while collecting data quickly from your users.


Need a good GUI Tool for MySQL or Redis? Try TablePlus. It’s is a modern, native GUI that allows you to simultaneously manage multiple databases such as MySQL, MariaDB, PostgreSQL, SQLite, Microsoft SQL Server, Redis, CockroachDB, Oracle, Cassandra… in a fast and easy way.


Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS.

TablePlus GUI Tool