zalando / tech-radar

Visualizing our technology choices
https://opensource.zalando.com/tech-radar/
MIT License
1.62k stars 625 forks source link

Mongo db on hold #13

Closed techyrajeev closed 7 years ago

techyrajeev commented 7 years ago

I really want to understand what is the reason for putting mongodb on hold. It would be really helpful if we get some insights about what caused you to put the tools, and technologies into those categories like thoughtworks does.

I was planning to use mongodb in my project but seeing that I had to think again.

I found mongodb is still at number 5 here http://db-engines.com/en/ranking

hjacobs commented 7 years ago

Some insights from our internal compendium:

A 3-node MongoDB (2.x) was used for event storage (timeseries), but due to massive performance problems later replaced with a single node PostgreSQL. ... Although version 3 looks promising, the consensus in the Technologist Guild is to wait for external success stories before having a look at MongoDB again.

IMHO: most of the MongoDB use cases can be easily achieved with jsonb in PostgreSQL. PostgreSQL "never failed us", so why should I trust in a data store with stories like https://aphyr.com/posts/284-call-me-maybe-mongodb .

techyrajeev commented 7 years ago

I see performance degradation was major issue. But you also suggest

"most of the MongoDB use cases can be easily achieved with jsonb in PostgreSQL."

But as far as I know PostgreSQL is RDBMS and MongoDB is Document based. How can two totally different systems can be compatible even if they do won't there be performance degradation due to making PostgreSQL compatible to MongoDB?

tlossen commented 7 years ago

postgres and mongodb are not fully compatible, but a JSONB column in postgres is conceptually a document -- not just text, but fully parsed and indexable data, that can be manipulated with special operators.

[...] jsonb data is stored in a decomposed binary format that makes it slightly slower to input due to added conversion overhead, but significantly faster to process, since no reparsing is needed. jsonb also supports indexing, which can be a significant advantage. https://www.postgresql.org/docs/current/static/datatype-json.html

for most use cases, this is "good enough".

tlossen commented 7 years ago

of course, there are some downsides as well .... http://blog.heapanalytics.com/when-to-avoid-jsonb-in-a-postgresql-schema/

hjacobs commented 7 years ago

@tlossen just as a note aside: "Hidden Cost #2: Larger Table Footprint" is not a disadvantage compared to MongoDB, as you always have this disadvantage in MongoDB (storing keys and values every time) :smirk: