How much faster is Redis at storing a blob of JSON compared to Postgres?
1–10 of 119 posts
Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#2Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#3Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#4Its like saying that memcache is faster than postgres.
they do different things for different purposes.
I still wouldn't trust redis for anything other than ephemeral storage. Most of the use cases where we use redis assume that the data will at some point go away. The places where we use postgres assume that data is permanent.
Infact, we use both together, and it works really well, best of both worlds.
Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#5Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#6Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#7That said, Redis is hugely expensive for any meaningfully sized data set. Thankfully our use case allowed us to keep our data size bounded over time, or else I would’ve traded latency for drastically reduced cost (eg use Postgres).
Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#8Its faster, but then, thats the point of it. Its like saying that memcache is faster than postgres. they do different things for different purposes. I still wouldn't trust redis for anything other than ephemeral storage. Most of the use cases where we use redis assume that the data will at some point go away. The places where we use postgres assume that data is permanent. Infact, we use both together, and it works re…
Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#9So it's no surprise that the Redis solution is faster. Besides parsing and indexing the data, PostgreSQL will also prioritize reliability and won't confirm your transaction until it's actually persisted to disk. Whereas Redis is prioritizing speed, and working straight to RAM--the disk serialization is an asynchronous process. If anything, I'm surprised that the Redis solution is _only_ 16-20x faster than PostgreSQL given what appears to be happening.
So, for this use case--storing a cache of Amazon API results for mostly-static data--the Redis solution is a no-brainer: durability of the data is not a serious concern; there's no real risk of data corruption because there's only one schema and no interrelations; you don't need the data store to know anything about the data; you don't need indexing beyond straight key-value. For other use cases, Redis might be entirely unsuitable because of durability or data integrity reasons, in which case the speed benefits wouldn't even matter.
Now, all that said, in the real world there are lots of other considerations: Are you using either of these databases already for some other purpose in the same app? Which data store is easier to set up? Which is easier to code against? Do you even care how fast it is if the slower speed is 11ms on a single-user system?
Re: How much faster is Redis at storing a blob of JSON compared to Postgres?
#10Its faster, but then, thats the point of it. Its like saying that memcache is faster than postgres. they do different things for different purposes. I still wouldn't trust redis for anything other than ephemeral storage. Most of the use cases where we use redis assume that the data will at some point go away. The places where we use postgres assume that data is permanent. Infact, we use both together, and it works re…
For a small project you might not want the added complexity of another database and decide to store JSON blobs in PostgreSQL. In this case it's important to understand the performance trade-off you're making.