6 ms·
> invariably all of those startups moved from MongoDB Why? Especially after point #1 and assuming the document-store was a good fit for the data model.
by manigandham 11y ago
> invariably all of those startups moved from MongoDB
Why? Especially after point #1 and assuming the document-store was a good fit for the data model.
- phs2501 11y agoCan't speak for the original poster, but at this point Postgres is a very capable and performant document-store database as well with the addition of the JSONB type and associated indexing and modification (in 9.5) functions. It's also more mature, has generally better durability than MongoDB, and it is easy to fall back/extend into relational queries on your document-store data if need be. IMHO, unless you have a situation such that Mongo's horizontal scaling is actually required, it's better to use Postgres even if you're doing document-store stuff.
- SEJeff 11y agohttp://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram http://instagram-engineering.tumblr.com/post/10853187575/sha... it certainly can be done with postgres, but isn't as simple.
- gjolund 11y agoPostgres is a better document store than Mongo. The only time I would recommend Mongo is for storing geo-spatial data, as it has several built ins that make it much easier to work with. Even then I find it a lot more convenient to keep that data in Postgres and replicate it to Mongo.
- rpedela 11y agoWhy not use PostGIS for geo-spatial data?
- gjolund 11y agoFor processing, 100% agree. However if the write load is very high then Mongo is better suited as the intial store. I then replicate to other dbs.
- takeda 11y agoMongo actually has worse performance than postgres, including inserting data. You can of course improve Mongo's speed by using weaker write concern, but you can also disable WAL in Postgres too.
- gjolund 11y agoFor a single server, I believe you are correct. However I found scaling write load past a single server's limits more difficult using Postgres than MongoDB. Fortunately that is part of what the OP addresses in his post.
- takeda 11y agoApologies, when I was talking about horizontal scaling I meant compared to other NoSQL databases[1]. The biggest selling point of NoSQL databases really is increasing performance and horizontal scalability due to removing some guarantees that RDBS provides. With MongoDB you get neither of the advantages. Generally with Postgres you can't scale easily, unless you only do reads, but postgres outperforms MongoDB. You can get some marginal improvement by running multiple MongoDB nodes, but a single Postgres will still outperform it. Also with benchmarks like this, it is often overlooked that in a relational database you often can store data in a smarter way and get extra boost of performance. For example in my previous job we had 3 MongoDB which were used for mapping IP address to a zip code. Those databases were 12GB each. They run on a beefy instances in AWS because they wanted to make sure all the data could fit in RAM. I did a POC and put the same data in Postgres and it essentially was just 600MB of data. All queries were sub milisecond, on smallest instance. How come? Well in Postgres I stored ranges of IPs using ip4r extension. And put an GiST index which works with ranges. Mongo did not understand IP addresses so what they essentially did is they computed every possible IPv4 address and stored it into 64 bit integer, then they placed an index which probably was bigger than the data itself. Their solution also won't scale with IPv6. [1] http://www.datastax.com/wp-content/themes/datastax-2014-08/files/NoSQL_Benchmarks_EndPoint.pdf?2 http://www.datastax.com/wp-content/themes/datastax-2014-08/f...
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- jeffdavis 11y agoI conjecture that it's rare that someone just needs a document DB. The main problem someone is thinking about may be solved by a document DB, but then they also have 1000 other problems they didn't think about that are a horrible fit for a document DB. And due to the nature of databases, where data has greater value when combined, using a new database system for every application isn't a great option. SQL is great for business data, and passable-to-good for everything else. So the only way to beat it is by being way better at some specific thing, and finding users where that specific thing is so important that it's OK if the data is on an island.
- takeda 11y agoBecause NoSQL is a hype. Many of the NoSQL essentially takes us back to 60s before Codd came up with relational model[1] These ideas tend to come back once in a while [2][3], but so far nothing is better than relational model. NoSQL still makes sense in many cases (generally when your specific use case does not need all guarantees of ACID), you can get in return higher performance or horizontal scalability. MongoDB is aim to be generic database but rides on the wave of NoSQL "coolness". It was created by people who had no experience in databases and are learning as they go[4]. As they started adding things that are essential for database they realized it's not that simple. Currently MongoDB is outperformed by Postgres. In fact there is an application called ToroDB which provides protcol compatibility for Postgres that emulates MongoDB and even that outperforms Mongo. Mongo also doesn't scale well horizontally, so essentially you don't really don't get any significant advantage. [1] https://en.wikipedia.org/wiki/Hierarchical_database_model https://en.wikipedia.org/wiki/Hierarchical_database_model [2] https://en.wikipedia.org/wiki/Object_database https://en.wikipedia.org/wiki/Object_database [3] https://en.wikipedia.org/wiki/XML_database https://en.wikipedia.org/wiki/XML_database [4] For example they started with mmap'ed memory regions to store the data. Did not initially use fsync() to make sure data is saved on disk. In a way it reminds me of MySQL several years ago. It's much better now than it was in the past, but it has a lot of warts left of from the past.
- devishard 11y agoMongoDB is really, really bad. I've never come across another product that was so horrible and yet so widely used. MongoDB: for when you don't need consistency, availability, or partition tolerance. There are some really good NoSQL products out there. I seriously think RethinkDB is on par with Postgres. I've also used Cassandra and BerkeleyDB and they're both decent. But unless some core part of your business logic is pathological to implement in SQL (like Reddit's comment trees) you should go with Postgres.
- developer2 11y agoNo no no, you don't understand at all. Mongo DB is webscale. /slashdot-comment
- 11y ago
- oconnor663 11y agohttp://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/ http://www.sarahmei.com/blog/2013/11/11/why-you-should-never...
- elmigranto 11y agoI don't like this one too much, because Mongo is wrong choice here domain wise, but this one was really convincing for me: http://cryto.net/~joepie91/blog/2015/07/19/why-you-should-never-ever-ever-use-mongodb/ http://cryto.net/~joepie91/blog/2015/07/19/why-you-should-ne...
- gjolund 11y agodiaspora was such an interesting project, I dream about resurrecting it often.
- stubish 11y agoBecause MongoDB is chasing a moving target. Hype, built in sharding and built in automatic failover are what it has now. The PostgreSQL project was strong when Mongo was conceived and has been accelerating. PostgreSQL has already gobbled up and improved on other MongoDB features like BSON and is where you go when you grow out of MongoDBs more primitive document model. Easy sharding and failover will fall too, years before MongoDB catches up with other must have features like transactions (you will need them eventually) or a half decent query language so you can actually maintain your code rather than having to plan your own queries and encode them as a sequence of JSON documents.