TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Can you replace Postgres with Redis (for some usecases)?

3 pointsby node-bayareaalmost 4 years ago
Hi there, I&#x27;m looking for a technical discussion. I&#x27;m looking for technical debate and I know what MySQL&#x2F;PG and Redis are capable of. What I&#x27;m looking for is a debate where you <i>disagree</i> that following. I want to start with an analogy. Gasoline cars vs. Electric cars We all know that you can use an electric battery to run a car.<p>But the thing is, when it comes to a gasoline car, even though it does literally have a battery, it’s not used for running the car. It uses batteries for starting the cars (generating an electric spark to light up the gas), A&#x2F;C, audio systems, lights, sensors, locks, and so on but not for running the car. Instead, it relies on an internal combustion engine (ICE) to run the car.<p>It turns out, ICE cars are highly inefficient. Only 16% to 25% of the power that’s generated actually makes it into the wheels. On the other hand, electric vehicles provide about 90% power to the wheels! Further, EVs also have major and additional advantages when it comes to the environment, repair costs, and so on.<p>If you are looking from the First Principles, even though virtually most cars that are built even today are gasoline cars, the fundamental truth is that they use an inefficient system.<p>Now if you look at an electric car, it takes advantage of this inefficiency to build a new type of car. In this case, it simply gets rid of the complex and highly inefficient engine and replaces it with a large battery and a motor to directly spin the wheels.<p>------------- Now coming to the Databases...<p>In the traditional architecture, you have a primary database (Postgres, Mongo, etc.) and a secondary database, a.k.a, cache (e.g. Redis or Memcache). The primary DB is used to store all the data and support CRUD operations. The caching DB is used for caching, session storage, rate-limiting, IP-whitelisting, Pub&#x2F;Sub, queuing, and many other things.<p>And if you think about it, when there is a cache-hit, we are practically using the secondary DB for part of the CRUD operations, but still not fully utilizing it as a primary database.<p>Does this remind you of the issue with gasoline cars? Just like they literally carry a battery to power numerous things except moving the car, the traditional architectures use things like Redis for everything else except as the main DB.<p>Do you see the similarities?<p>What if we use the First Principles thinking to do what the electric car did? Similar to how EVs got rid of the engine, what if we get rid of the slow and inefficient primary database and simply use the cache DB as the main database?<p>https:&#x2F;&#x2F;redislabs.com&#x2F;blog&#x2F;dbless-architecture-and-why-its-the-future&#x2F;

6 comments

yongjikalmost 4 years ago
Feels rather spammy to me...<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27779824" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27779824</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27784100" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27784100</a>
shooalmost 4 years ago
Analogies can be a useful way to generate questions but dangerous when used to provide answers.<p>-- misremembered paraphrasing of someone else&#x27;s snappy quote<p>So, a fun question could be: what are &quot;first principles&quot; for car engine design? what are &quot;first principles&quot; for data storage in distributed system design? are those two sets of first principles the same, or are they wildly different, with different goals and constraints?<p>i clicked through the link and was sad to see no clear articulation or evidence of any kind of &quot;first principles&quot; thinking. it would be genuinely interesting to see a solid analysis.<p>edit: aha, it seems like it i am remembering something Martin Fowler wrote once:<p>&gt; [...] I&#x27;m very suspicious of using metaphors of other professions to reason about software development. [...] it all comes down to how you use the metaphor. Comparing to another activity is useful if it helps you formulate questions, it&#x27;s dangerous when you use it to justify answers.<p>- <a href="https:&#x2F;&#x2F;martinfowler.com&#x2F;bliki&#x2F;MetaphoricQuestioning.html" rel="nofollow">https:&#x2F;&#x2F;martinfowler.com&#x2F;bliki&#x2F;MetaphoricQuestioning.html</a>
hardwaresoftonalmost 4 years ago
They’re different databases that do different things with different features and different ways of laying out data. Redis functions as a cache, not a relational database — it’s not merely about speed of response.<p>Do not use redis as your main database, it will require you to contort very painfully to so things that are normal to most apps. Maintaining Lua scripts instead of SQL queries is a bad idea.<p>If this is an ad for redis labs then it’s a really bad one.<p>If anything you should be going the other way, postgres is rocksolid and you could literally run redis as a postgres extension if you wanted. It is the more flexible, battle proven tool.
评论 #27790776 未加载
hardwaresoftonalmost 4 years ago
They’re different databases that do different things with different features and different ways of laying out data. Redis functions as a cache, not a relational database — it’s not merely about speed of response.<p>Do not use redis as your main database, it will require you to contort very painfully to so things that are normal to most apps. Maintaining Lua scripts instead of SQL queries is a bad idea.<p>If this is an ad for redis labs then it’s a really bad one.
评论 #27790782 未加载
node-bayareaalmost 4 years ago
Here is the article for your reference: <a href="https:&#x2F;&#x2F;redislabs.com&#x2F;blog&#x2F;dbless-architecture-and-why-its-the-future&#x2F;" rel="nofollow">https:&#x2F;&#x2F;redislabs.com&#x2F;blog&#x2F;dbless-architecture-and-why-its-t...</a>
tarun_anandalmost 4 years ago
There are lots of in memory Sql speaking stores like Memsql and voltdb. Won&#x27;t they be a better fit than Redis in case you wanted the speed that comes with accessing data in memory?<p>What use case are you looking at?
评论 #27790757 未加载