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.

SQL or NoSQL? Why not use both (with PostgreSQL)?

12 pointsby burggrafover 2 years ago

1 comment

burggrafover 2 years ago
SQL or NoSQL? These days it&#x27;s a religious argument (tabs vs spaces, anyone?) I&#x27;ve been using SQL since the late 80&#x27;s, and spent several years working with NoSQL offerings. There were some really great things about using a document-based database -- mainly being able to take a block of JSON from my front-end app and throw it into a database. That was great.<p>But over the years, some of my NoSQL projects made me start to yearn for those things that are super easy to do in SQL, but can be a pain with a document database. Quick aggregate queries to answer business questions: How much did we sell of this product last month in each region? Or I&#x27;d want to change the schema of my data, and it would be a pain to do that in a document database. I&#x27;d have to write a script to migrate the data, and then I&#x27;d have to change my code to use the new schema. Or else my code started filling up with code to manage the schema. if (typeof total_sale !== &#x27;undefined&#x27;)...<p>Once I figured out that it&#x27;s easy to throw JSON data into Postgres, I was able to get the best of both worlds. I&#x27;m not saying SQL is always better -- it totally depends on the application and what your needs are. But I&#x27;ve also been bitten before by &quot;oh this is easy to do in NoSQL because the data is just a simple document&quot; followed three months later by &quot;the app is working great -- but now can we do X, Y, and Z?&quot; And I&#x27;m thinking &quot;why didn&#x27;t you ask for those things before we built the app? I should have done this in SQL.&quot; Ugh.<p>Your comments and questions are welcome!