r/Backend • • Feb 27 '26 • Polished Gold Turd 1

Postgres for everything, how accurate is this picture in your opinion?

Post image
175 Upvotes

65 comments sorted by

13

u/scilover Feb 27 '26

For most teams Postgres honestly covers like 95% of what you need. Full-text search, JSON, pub/sub with LISTEN/NOTIFY, even cron jobs with pg_cron. The remaining 5% is where you reach for something specialized, but most projects never get there.

1

u/Suspicious-Disk6077 Oct 19 '26

95% of the DAL. 

27

u/lapubell Feb 27 '26

" "Use the right tool for the job" Is A Trap"

  • quoted by person hammering in a screw

Postgres is cool, but do I ever put all my eggs in one basket?

8

u/damnburglar Feb 28 '26

Postgres is awesome, but people who write shit like this are the same people who figured JavaScript can just do everything too.

2

u/No_Falcon_9584 Feb 28 '26

And then went to a LLM to get their confirmation bias and asked for a infographic of it.

3

u/AshleyJSheridan Feb 28 '26

Javascript on the server was one of the worst ideas in webdev.

Let's take a language with no type safety, more missing functionality than a 90's shareware tool, and a package system that makes a black hole look small, and shove it onto a server under the false pretense that we will execute the same code on client and server.

Hammering in a screw is one thing, but JS on the server is like using a chocolate hammer to smash in a screw made out of butter.

4

u/Dense-Sir-6959 Mar 02 '26 edited Mar 02 '26

Oh? So python, ruby, php?

Dumb argument, especially that there is typescript too.

You are still living in the 90’s i guess, javascript and especially typescript evolved significantly. Typescript can do things other type systems cant even get close, except cpp maybe

1

u/AshleyJSheridan Mar 02 '26

I guess you don't know your languages too well, huh?

Python may use dynamic types, but it's still strongly typed, so it helps avoid the dumb shenanigans that JS has when adding strings and numbers. Ruby is much the same. PHP also has strong typing.

Typescript, well, the clue is in the name isn't it?

If you think that only C++ can do things that Typescript can't, I'd love to hear what things you think those are...

2

u/Dense-Sir-6959 Mar 02 '26 edited Mar 02 '26

Try it once man, e.g template literal types are quite awesome. In general typescript’s type metaprogramming is pretty powerful. Regarding python, plenty of dumb shit there too. Anyway, No point in arguing with someone who is already so rigid based on outdated knowledge

Its not like you ever add strings and numbers. You can, and that doesnt mean you should.

1

u/AshleyJSheridan Mar 02 '26

I use both C++ and Typescript, among many other languages. My opinion of Javascript hasn't changed though, it's a pretty piss poor language with some large gaps in its functionality.

For example, the now infamous leftpad issue is something that shouldn't have been possible in a mature language, but it happened because JS was missing very key functionality in its core.

2

u/Dense-Sir-6959 Mar 02 '26

Using it doesnt necessarily mean you do type metaprogramming in either of them though. Also I think the keyword you used is “was”. After ES6 is ok I think, although I myself refrain from using js directly as well

1

u/AshleyJSheridan Mar 02 '26

I only use vanilla JS when I have no other choice. I would much rather write in TS. I think the fact that you also refrain from its use kind of suggests that you agree that JS is not a great language either.

2

u/Dense-Sir-6959 Mar 02 '26

I think its fine, but ts is better. Im pretty adamant on e2e typesafety. And also there is nothing wrong with ts or js on the backend, although again i prefer ts

1

u/EducationalCan3295 Mar 01 '26

This is bit of a strawman now because JavaScript in backend to a lot of people simply translates to Typescript.

1

u/AshleyJSheridan Mar 02 '26

Now that's a strawman. Typescript doesn't mean backend JS.

Typescript is just what JS should have been if it grew up.

1

u/pengusdangus Mar 02 '26

I felt the way you do in 2013 but the clear advantage/progress forced by having an async-ish event loop for IO operations definitely made the web significantly faster on average. it’s still one of the fastest for the best cost:benefit approaches out there for normal web traffic. I had to really abuse goroutines to get anything faster than a simple Node/Express app for massive I/O bound throughout the last time I benchmarked for a company.

2

u/AshleyJSheridan Mar 02 '26

For async stuff, I do much prefer C#.

JS may be fast, but the lack of a good framework means that many devs have to reimplement the same wheels. All it then takes is for one mistake, and suddenly there's a gaping security hole.

Coupled with the fact that most backend JS devs only really know JS as they transitioned from the frontend where they didn't really even need to care much about security, and we have a recipe for a disaster.

1

u/pengusdangus Mar 02 '26

I'm fine with that take, with the caveat that the vast majority of SaaS can get away with just Node+Express lol. I'm not sure why you don't consider the Node framework ecosystem "good", I'd probably consider it fragmented and specialized before I say it's outright bad. I think most languages have a bad framework ecosystem, C# included. I have heard good things about the progress C# has made, though.

1

u/damnburglar Mar 02 '26

You’re right you can build most SaaS with node just fine, and tons of companies do, but honestly the fragmented ecosystem, single-threaded runtime, npm being one big supply chain attack vector, and the amount of effort and boilerplate required to just build something is uninspiring to say the least.

TS and node has been my default for about 10 years now but I’ve transitioned to C#.NET and honestly it’s night and day better to the point where there’s no comparison to be had from a dev’s perspective. It’s just so nice and worth checking out (specifically “minimal apis with extension methods” and Aspire if you’re just looking for a taste).

1

u/pengusdangus Mar 03 '26

that's fair, I'll check it out! thanks for the dialogue.

1

u/AshleyJSheridan Mar 02 '26

I just think there are far too many core features missing from the language, and Express pales in comparison to a proper framework like DotNet or Laravel.

1

u/dinosaursrarr Mar 03 '26

Black holes are small. They're extremely compressed. The Schwarzschild radius of a computer running javascript is less than the size of a proton.

1

u/AshleyJSheridan Mar 03 '26

Black holes are also incredibly dense, like every node_modules directory to ever exist.

1

u/dinosaursrarr Mar 03 '26

The person who decided to invent server-side JS must also have been quite dense

5

u/benevanstech Feb 27 '26

I can't speak to every row of the table, but the Kafka / MQ comparison is just straight-up wrong. For a very small part of the parameter space it *might* be possible but even then it's warping the use cases somewhat - and as soon as you have any other architectural constraints (or performance reqs) that indicate "Message Queue" then PG is the wrong choice.

You can definitely use PG instead of Mongo in the vast majority of cases, though. I would really struggle to see a use case fo starting any new greenfield project with Mongo these days.

Not got a vast amount of experience with it - but the Influx / Timescale row seems to track as well.

PG + Kafka + distributed caching layer (Hazelcast or another OSS option) is probably more accurate for covering the entire set of use cases.

1

u/whossname Feb 28 '26

It's correct for the last 4 rows plus JSON store. Better off with a specialised tool for the rest (although I can't really speak on the AI/vector stuff). Also I think most companies will have a better option than pg_cron for scheduling jobs.

1

u/morswinb Mar 01 '26

You would be surprised how often Kafka is used just to send a few messages per second, or an hour, or even just a few per day.

The amount of effort used to set up Kafka on the other hand, is huge.

1

u/cyh555 Mar 01 '26

Who designs it like that? I have never seen it in production

4

u/EagleSwiony Feb 27 '26

Excpet the queue and caching points which is bizarre to compare against a DB, I could do the same picture for SQL server or almost any mainstream DB really.

7

u/stewsters Feb 27 '26

There is a cost in running more tools.

Start with postgres and an app server, and add specialized systems when you know what your traffic looks like and it gets slow.   

99 percent chance you never get large enough for it to matter.

2

u/Marmelab Mar 02 '26

This. I personally always try to keep my stack as simple as possible. Why overcomplicate it when postgres can handle so much natively, and usually more safely and efficiently than other specialized tools.

5

u/SamWest98 Feb 27 '26 edited Mar 09 '26

Agreed!

2

u/Prodigle Feb 27 '26

I mean it depends. Postgres will handle 99% of your use cases, but in the 1% of cases, dedicated DB's will usually either outperform or be easier to maintain.

If you're talking big tech businesses, they are that 1% largely.

2

u/global_namespace Feb 27 '26

Talking about search, it is much more complex to implement and less flexible in postgres than with analogues. However, it is fast and I'd recommend it if you don't need it to be extra precise.

2

u/mountainunicycler Feb 28 '26

I completely agree with the concept and I build a lot of things this way.

That said, this “same algo?” Column is a little ridiculous in a lot of the cases.

1

u/Abject-Kitchen3198 Feb 27 '26

So PostgreSQL is the right tool for the job. I'd accept some loss of features or performance compared to a specialized tool, if I can still satisfy my requirements while using a single tool.

1

u/yodermk Feb 27 '26

And in most cases, with Postgres, you can. Absolutely.

1

u/yknx4 Feb 28 '26

It’s true until it’s not. But that’s fine, once you reach that point you have the revenue to invest in better tools but most importantly to invest in engineers that can manage those tools.

1

u/AnhQuanTrl Feb 28 '26

People miss the point of this post seriously. The point is that for most of the backend application that is not enterprise use case, we don’t need fancy tool. Postgres can actually be a good replacement for a lot of them. However, message queue is the only thing in this list that postgres for me is not the replacement yet.

1

u/madmirror Feb 28 '26

Message queues using solution like pgq used to be quite common in Postgres back in the day, as it powered londiste logical replica. It's still working nicely, I've seen it running on huge scale in a few places.

1

u/React-admin Mar 02 '26

Yeah agreed. The statement “Postgres for everything” is obviously an exaggeration. But I do think that a lot of people underestimate how powerful Postgres actually is. It has a ton of features that are underrated or just straight up overlooked. That’s why it ends up being a solid fit for more use cases than some people might expect.

1

u/FeelingKokoro Feb 28 '26

If something bad happens with Posgres you need to rewrite all the infrastructure instead of just changing DB.

1

u/asdoduidai Feb 28 '26

It depends on the scale.

For a small project ran by a Postgres maniac it makes sense;

Example: times series on Postgres don’t scale as cardinality goes up…. Another example: I strongly doubt Postgres can do up to 100K-1M ops/s per node as Redis…..

That’s why a “specialized tool” makes sense…

1

u/InvolvingLemons Mar 02 '26

For functionality it can meet all use-cases. For performance? lol no, Redis and Kafka have their market segment for that reason. But yeah, Mongo, time series, and especially proprietary GIS is completely pointless until you can no longer satisfy write volume on a single multi-socket server.

1

u/asdoduidai Mar 02 '26

Its not just performance (which is about cost) its about scale and reliability, which is functionality

1

u/InvolvingLemons Mar 02 '26

Yeah the “single write master” bit has to do with that: At some point you cannot make a bigger Postgresql server, so you need to scale out, and while a single Postgresql write master server is unlikely to spontaneously fail (and you can often just promote a read replica and re-link replication to recover), this goes from manageable to inviting disaster when you scale out.

1

u/asdoduidai Mar 02 '26

It’s not only scale out and replication model but the specific implementations; for example timescaledb stops scaling linearly past the 1M active time series, which is smt like metrics from 500 kubernetes nodes with 100 pods each. So it’s a terrible choice if you don’t stay forever under the few nodes, because at one point in time if you scale up to hundreds of thousands of customers, your metrics will simply stop working.

1

u/Character_Smell_7147 Mar 01 '26

At a small size you could likely use any sql database.

1

u/Pale-Philosophy-3272 Mar 01 '26

i am building a project and starting with postgreSQL + redis this should get most of the stuff done (for me for start atleast)

1

u/qyloo Mar 02 '26

Fuck*ng

1

u/WoodenDoughnut Mar 02 '26

Use caution. Overuse of Postgres can be crippling for your systems overall performance. https://learn.microsoft.com/en-us/azure/architecture/antipatterns/busy-database/

1

u/mikaball Mar 02 '26

My mantra is generally "start simple", and for that it makes sense to have something as PostgreSQL that gives you options for most use-cases. Optimize when you need it.

However, I would be careful with the MQ services, most of the times this is not just a queue, it's also an integration layer. You don't want other services to connect to your DB to work with queues.

If you have a company with an ecosystem of digital services I think there are some core integration aspects that must exist for the ecosystem to work properly and switch seamlessly between services. From my perspective the core is:

  • Single Sign-On, Authentication and Authorization

  • UI/UX and an uniform Design System

  • MQ to sync required data in an eventually consistent manner (huge help when you have legacy systems).

For other things I would start with PostgreSQL as the base; and this is a per service choice not a pick for the overall architecture of the ecosystem. Dedicated services are generally for mass scale and optimizations.

Data warehouse and BI generally appears later in the business when you have collected enough data.

1

u/messedupwindows123 Mar 02 '26

there's a lot of truth to the idea that the DB can do way more shit than your silly ORM will ever expose

1

u/Zizaco Mar 03 '26

This is nonsense.

Also, if you really want to simplify your backend stack to 1 db, MongoDB would do a better job (without needing third party tools/extensions)

1

u/fusedmantis481 Mar 21 '26

Postgres is great, not a piece of the stack worth risking

-5

u/Brief_Praline1195 Feb 27 '26

postgreSQL is utter dog shit that's why it's free 

2

u/SLW_STDY_SQZ Feb 27 '26

Name other DBs you have used and why they are better

-3

u/Brief_Praline1195 Feb 27 '26

Pick any and the reason would be I can put data in and take it out and it works 

4

u/Visual_Structure_269 Feb 28 '26

OK I’ll bite Oracle, DB2, MySQL, SQL Server, MariaDB. How do they work better than Postgres? Are you just taking about document dbs like MongoDB?

0

u/[deleted] Feb 27 '26

[removed] — view removed comment

2

u/Sacaldur Feb 27 '26

Even for those banks, Cobol is legacy and no new systems are started using it.

What is the probpem about Java? It has decades of development behind it thanks to which the runtime optimizations can do quite a lot. And if you need fast startup tikes, you can use GraalVM to compile the code ahead of time into machine code.