News for hackers. Stuff that matters.
Re:Mongo but on Postgres and with strong consistency benefits by jimmyl02 on Monday July 08, 2024 @12:25AM (#40902596)
the view I now have is that for a relational table, yes you have to suffer through migrations but at least they are in sql. for document based stores, you still have to have migrations, but they are just implemented in code

json documents sound great, especially initially, but end up being a maintenance nightmare

Re:Mongo but on Postgres and with strong consistency benefits by hans_castorp on Monday July 08, 2024 @12:56AM (#40902715)
> for document based stores, you still have to have migrations, but they are just implemented in code

The problem with that - in my experience - is that migrating the structure for thousands (if not millions) of documents is way slower than running a DDL command (as it means reading each document, parsing it, modifying it and writing it back). Many DDL commands are just metadata update to the system catalogs so they are quite fast (e.g. adding a new column with a default value). With documents you wind up with millions of single row updates.

This can be mitigated by doing a "lazy" migration when a document with the old structure is first read. But that makes the code much more complicated.

Re:Mongo but on Postgres and with strong consistency benefits by globular-toast on Monday July 08, 2024 @03:28AM (#40903321)
Or, to put it another way, yes you have to write and maintain an upfront schema, but a document-based system has a schema too, it's just distributed amongst 50 codebase and 10 people's heads.