Live data from Hacker News

Just use Postgres

mccue.dev

111–120 of 238 posts

Re: Just use Postgres

#111
post #64

From the article, DynamoDB-likes are good IF: * You know exactly what your app needs to do, up-front But isn't this true of any database? Generally, adding a new index to a 50 million row table is a pain in most RDBs. As is adding a column, or in some cases, even deleting an index. These operations usually incur downtime, or some tricky table duplication with migration process that is rather compute + I/O intensive..…

50M rows is really not that much, I’d guesstimate an index creation to take single-digit minutes. None of these operations I’d expect to cause downtime, or require table duplication or to be risky Edit: to be fair, you’re right there’s footguns. Make sure index creation is concurrently, and be careful with column default that might take a lock. It’s easy to do the right thing and have no problem, but also to do the w…

Newer versions of Postgres also support dropping indexes concurrently. I recommend using the concurrently option when dropping unused or unneeded indexes on any table with active writes and reads. https://www.postgresql.org/docs/current/sql-dropindex.html

Re: Just use Postgres

#113

I've found out key/value databases pushes for better architectural designs in enterprise environments. Especially in companies where different teams are responsible for a given business capability and it needs to scale above 1+ million users. Postgres flexibility enables for design that is hard to scale. Both in terms of maintainability and performance. Enforcing K/V as a default database in one of my previous compan…

So like how do you do that? How do you store the user record for example as kv?

Re: Just use Postgres

#114

Earlier quoted context omitted.

May I ask question about this part? "Push all your business logic into big long stored procedures/functions - don't be pulling the data back and munging it in some other language - make the database do the work!" From my courses I had at university, I've been led to believe that the current trend is doing hexagonal architecture, as that allows for better modularisation of the project and helps keep code clean over ma…

Not OP, but I think it's a valid approach. You gain: Model consistency guaranteed by the database, your backend basically only acts as an external API for the database. You lose: Modularity, makes it harder to swap out databases. Also, you have to write SQL for business logic which many developers are bad at or dislike or both. I've seen a system running on this approach for ten years and it survived three generation…

That's interesting way of doing things, I'll admit. Thank you for helping out :)

Re: Just use Postgres

#115

Earlier quoted context omitted.

Fully agree. At that level, the justification for using MongoDB usually boils down to not wanting to deal with table schemas or SQL. In both cases, there are better alternatives.

I’ve heard stuff like this from supposedly senior people - if we use mongo we can just store anything, we don’t need to think about a schema (also you can only store short strings in an SQL database)

Good Lord the level of incompetence is terrifying

Re: Just use Postgres

#116
post #79

Earlier quoted context omitted.

> It's not worth pointing out the technical flaws in the post[1]. It might help your argument if you pointed out a real technical flaw in the content of the post, and not an example of the author being mistaken about a stranger's first name.

sure. 1. sqlite can have more than 1 file when using wal mode. 2. You don't need to know your exact dyanmodb access patterns upfront, you can evolve the schema. again, not worth effort to point out more.

I believe what the author has in mind is the fact that you need to create your LSI at the same time as you create the table, you cannot add them later (until GSI). So there's some truth to what they are saying regarding access patterns.

Re: Just use Postgres

#117

Earlier quoted context omitted.

May I ask question about this part? "Push all your business logic into big long stored procedures/functions - don't be pulling the data back and munging it in some other language - make the database do the work!" From my courses I had at university, I've been led to believe that the current trend is doing hexagonal architecture, as that allows for better modularisation of the project and helps keep code clean over ma…

> "Push all your business logic into big long stored procedures/functions - don't be pulling the data back and munging it in some other language - make the database do the work!" This is one of the categories of opinions that I’ve heard, the proponents of which suggest that databases will typically be more efficient at querying and transforming data, since you’ll only need to transfer the end result over a network an…

Thank you :)

Re: Just use Postgres

#118
post #15
post #8

Earlier quoted context omitted.

Why would you run Postgres on a different box in such a scenario? A docker run command to get a Postgres instance up and running isn’t any more complicated than linking in Sqlite, maybe even simpler. And you get proper ACID transactions for free.

1) Fault isolation in case of hardware failure 2) You may not even be able to _think_ about using Docker (OS restrictions, airgaps to install images, etc.) These are just 2 that come to mind from working in regulated industries.

In this thread, we're making a comparison to running Sqlite. Fault isolation is not an argument.

And you don't have to run Docker to run Postgres, it's just an easy way to do so. Even airgapped.

Re: Just use Postgres

#119
post #96

Earlier quoted context omitted.

The explanation is in the paragraph before it

except its factually incorrect when applied to Mongo[1]. [1] https://news.ycombinator.com/item?id=41273563

You can also shard with postgres, how is that a USP of Mongo?

Re: Just use Postgres

#120
post #28

> If you see a college student or fresh grad using MongoDB stop them. They need help. They have been led astray. I like this sentence way more than I should.

I don’t. How are new grads supposed to learn the ups and downs of different choices they make? Just being told they’re led astray in a blog post isn’t gonna work - it’ll backfire. I used node as a new grad for things it wasn’t meant for and that’s how I learned what it is good at and what it isn’t.

Out of curiousity what were the things you shouldn't have used node for?
Post reply on HN