Live data from Hacker News

Just use Postgres

mccue.dev

141–150 of 238 posts

Re: Just use Postgres

#141
Okay, I am very sorry that I got Rick Houlihan's name wrong.

In my defense, I hadn't watched his talks _recently_ and we've all been Berenstain Bear'ed a few times.

But also the comparison of DynamoDB/Cassandra to MongoDB comes directly from his talks. He currently works at MongoDB. I understand MongoDB has more of a flowery API with some more "powerful" operators. It is still a database where you store denormalized information and therefore is inflexible to changes in access patterns.

Re: Just use Postgres

#142

Personally, most of the projects i do are in self-hosted servers. The traffic isnt big. In such cases sqlite has been way better than postgres. Many times i see postgres not well used. Its meant for big project, not small ones.

I agree. Sqlite is fine unless you need concurrent write connections. I use it for everything.

Re: Just use Postgres

#143
post #3

There is absolutely no reason you can't make SQLite go all the way. Starting with it is the only thing that makes sense to me. It is certainly a higher performance solution in the fair comparison of a hermetically sealed VM using SQLite vs application server + Postgres instance + Ethernet cable. We're talking 3-4 orders of magnitude difference in latency. It's not even a contest. There are also a lot of resilience st…

The latency advantage is nothing compared to the advantage you can get with a better query planner.

Re: Just use Postgres

#144
post #58

Ah yes, the I don't have any other use case therefor all others are not good

Yes, one very common use case where Postgres does not scale well is analytics. Snowflake, Vertica, and ClickHouse work much better. I say this after working on several projects where development teams hit a wall with row storage databases. Still, PostgreSQL is great, it's my default DB as well.

Hit a wall because they didn't want to buy faster disks? What hardware were they running?

Re: Just use Postgres

#145
post #3

There is absolutely no reason you can't make SQLite go all the way. Starting with it is the only thing that makes sense to me. It is certainly a higher performance solution in the fair comparison of a hermetically sealed VM using SQLite vs application server + Postgres instance + Ethernet cable. We're talking 3-4 orders of magnitude difference in latency. It's not even a contest. There are also a lot of resilience st…

Sure. I think the caveats I mentioned are real though.

Using SQLite locks you out of some platforms as a service and out of some application architectures. It also means you need to be doing stuff like snapshotting your VM every x minutes.

Given minimal certainty about the scale, future, and properties of your application and organization: Postgres is the better default.

Re: Just use Postgres

#146
post #55
post #40

Earlier quoted context omitted.

> They have been led astray. They haven't though. What's wrong with using a tool even if it might be bad? Especially as a fresh user. It's how we learn. From both good and bad experiences. > They need help. Sadly it's not the fresh grad, but the "experienced" that only keep their old experiences that need help. Is this comment from 2010? MongoDB has improved. Maybe not to the point of being the best but definitely no…

> Especially as a fresh user. It's how we learn. From both good and bad experiences. I'd do that, but a superior strategy is letting other people make mistakes and then learning from them. It is best to always be making choices that seem like they could be optimal, with very rare exceptions.

I agree. But unless you are at least tangentially involved, you are likely not to hear such „gone bad“ stories.

First, people are not nearly as self reflective or admit to failures at all. And second, a bad tech decision might not be directly observable (as you will then often see ppl fighting symptoms rather than change and identify the root cause).

Re: Just use Postgres

#147
post #141

Okay, I am very sorry that I got Rick Houlihan's name wrong. In my defense, I hadn't watched his talks _recently_ and we've all been Berenstain Bear'ed a few times. But also the comparison of DynamoDB/Cassandra to MongoDB comes directly from his talks. He currently works at MongoDB. I understand MongoDB has more of a flowery API with some more "powerful" operators. It is still a database where you store denormalized…

> It is still a database where you store denormalized information and therefore is inflexible to changes in access patterns.

It is flexible and you don't need to know your exact access patterns upfront. It may not be as flexible as your chosen technology, but that doesn't make your statement true.

Re: Just use Postgres

#148

Totally agree - I have tried many databases of all flavors, but I always come back to Postgres. HOWEVER - this blog post is missing a critical point.... the quote should be: ---> Just use Postgres AND ---> Just use SQL "Program the machine" stop using abstractions, ORMs, libraries and layers. Learn how to write SQL - or at least learn how to debug the very good SQL that ChatGPT writes. Please, use all the very powerf…

You should use the most powerful and convenient language you have at your disposal, which is most likely the host language.

ORMs are funny things, it's like we got stuck in the idea of making the database object oriented. MongoDB just means we don't have to pretend anymore, not that it was a good idea.

It is perfectly possible to use relational concepts in a general purpose language. Tables, Columns, Foreign Keys, Records, Indexes, Queries etc. And you can build whatever Model abstractions you need on top of that; or not, for simple CRUD you don't really need a type system.

I usually build that layer along with the foundation of the application, it still evolves slightly every time around but the basics are very tried and proven by now.

https://github.com/codr7/hostr/tree/main/src/Hostr/DB

Re: Just use Postgres

#149
There's a lot of _very_ arguably false statements in here, esp around mongo and dynamo.

Postgres still has to "rewrite" data if you need another index. In fact it's about the same amount if you had to add an index for dynamodb...

Also, when's the last time you changed your primary key in a postgres table? Or are you just adding indexes?

Re: Just use Postgres

#150

Almost all statements about MongoDB are wrong. > You know exactly what your app needs to do, up-front No one does. Mongodb still perfectly fits. > You know exactly what your access patterns will be, up-front This one also no one knows when they start. We successfully scaled MongoDB from a few users a day to millions of queries an hour. > You have a known need to scale to really large sizes of data This is exactly a g…

> This is exactly a great point. When data size goes to a billion rows, Postgres is tough. MongoDB just works without issue.

Is it though ? Maybe 5-10 years ago it was.

Post reply on HN