Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Should I use Redis when I have PostgreSQL as my database for Django? [closed]

People also ask

Why use Redis with Postgres?

A Redis in-memory database cache allows you to access frequently used data from your server's RAM. This minimizes unnecessarily load and roundtrips to your PostgreSQL database server.

Why Redis is use in Django?

Redis is an in-memory data structure store that can be used as a caching engine. Since it keeps data in RAM, Redis can deliver it very quickly. Redis is not the only product that we can use for caching.

Should I use Redis or PostgreSQL?

"Relational database", "High availability " and "Enterprise class database" are the key factors why developers consider PostgreSQL; whereas "Performance", "Super fast" and "Ease of use " are the primary reasons why Redis is favored.

When would you use Redis as a database?

Redis can be used with streaming solutions such as Apache Kafka and Amazon Kinesis as an in-memory data store to ingest, process, and analyze real-time data with sub-millisecond latency. Redis is an ideal choice for real-time analytics use cases such as social media analytics, ad targeting, personalization, and IoT.


Redis is a key-value storage system that operates in RAM memory, it's like a "light database" and since it works at RAM memory level it's orders of magnitude faster compared to reading/writing to PostgreSQL or any other traditional Relational Database. Redis is a so-called NoSQL database, like Mongo and many others. It can't directly replace PostgreSQL, you still want permanent storage, but it works along with Relational Databases as an alternate storage system. You can use Redis if your IO operations start getting expensive and it's great for quick calculations and key-based queries.

You can include it in your Django/Python project with a wrapper, for example redis-py.

Redis is very simple to install and use, you can check the examples at redis-py. Redis is independent from any Relational Database, that way you can use it for caching, calculating or storing values permanently and/or temporarily. It can help reduce querying to PostgreSQL, in the end you can use it the way you want and take advantage from it to improve your app/architecture.

This similar question can help you Redis with Django