Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can redis supports queries like sql join and group by while replacing sql DB with Redis?

Tags:

sql

redis

I have a project in which i need to replace the SQL DB with REDIS. Its a job scheduling system. There are tables like JobInfo, TaskInfo, Result, BatchInfo etc. What is the best way to map DB tables in REDIS server key value pair?

There are join and group by kind of queries used in the project. What is the best way to replace the sql server with the redis server? Also does redis provides a way with which i can query the data like i can in join and group by queries?

like image 894
user888270 Avatar asked May 15 '16 07:05

user888270


People also ask

Can I use Redis instead of SQL?

There are no tables available in Redis but the Redis data structures are available as the replacement for tables. So the most important step in the transition is remodelling the tables into Redis data structures. With this option, we normally need to make changes in the system code to use Redis commands instead of SQL queries.

What is the difference between redisql and JSON?

RediSQL can also store results of queries into a Redis Streams. This allows different clients to consume part of the result, or to delay the consuption of a result. Moreover, it allows caching the result of expensive queries as Redis Streams to consume them over and over again. JSON is the de-facto standard for sharing data between applications.

What is redisql and why should you care?

RediSQL provides you with lightweight in-memory databases. It could completely shift your architecture. For example, you could create a new isolated database each day, one for each application tenant, or even one per user. While RediSQL focuses on in-memory database, it can also store data in a regular file.

What is the difference between redisql and in-memory database?

For example, you could create a new isolated database each day, one for each application tenant, or even one per user. While RediSQL focuses on in-memory database, it can also store data in a regular file.


1 Answers

Redis is basically a key-value store (a bit more sophisticated than just a simple one, but yet - a key-value db). the value may be a document that follows some schema, but Redis isn't optimized to search for those documents and query them like other Document Databases or like relational database such as SQL Server.

I dont know why you're trying to migrate from SQL Server to Redis, but you need to re-check yourself if that's the right design choice. If you need fixed schema and join operations - it may suggest that Redis isn't the right solution.

If all you're looking for is caching, you can cache in the application layer, or use other solution to integrate your Redis and SQL Server (I wrote simple open-source project that does that: http://redisql.ishahar.net ).

Hope this helps.

like image 172
Shahar Gvirtz Avatar answered Sep 30 '22 02:09

Shahar Gvirtz