Live data from Hacker News

PostgreSQL Outperforms MongoDB in New Round of Tests

blogs.enterprisedb.com

141–150 of 171 posts

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#141
post #97
post #65

Did I miss something? MongoDB was never ever faster than Postgres. That's nothing new. Most of these things are clear when one reads the MongoDB docs: MongoDB stores Metadata, (nearly) uncompressed on a per document basis, so of course it uses way more diskspace. It doesn't store the data in any efficient way either. Also it's pretty much unoptimized, compared to Postgres which has been around for a really long time…

The entire narrative behind MongoDB in the first chapters of its evangelism was performance, partly due to its document-oriented approach (things are quicker in some scenarios when you get rid of relations, and it was contrast against the many tables approach), which is something that you can only very recently do in pgsql, and partly due to implementation choices like the dangerous default lack of fsync. Early evang…

I'll pose the inappropriate question. Unless you are going to do it right (RethinkDB) why write a brand new database at all (MongoDB?)

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#142

Earlier quoted context omitted.

Just because you haven't had a failure yet , it doesn't make the test any less true.

Three years? Numerous customers? That's good enough for me so far.

C'mon you know that isn't fair reasoning, you could say the same about running backups. Just because someone hasn't seen the need for backups for three years after numerous customers doesn't mean thats a good enough reason to not keep backups.

I'm not saying you shouldn't use Mongo, but to say Aphyr's assessment of database shouldn't be considered in all deployments isn't wise.

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#143

Earlier quoted context omitted.

The improvements to hstore (primarily to make it hierarchical and add array support) ended up becoming jsonb.

Could you confirm that you can atomically update a single item inside a jsonb field without reading/writing all of the jsonb data? I know this is possible with hstore (but not 9.3's json type), but can not find a clear answer for jsonb in the documentation. Any pertinent links would be much appreciated!

You can't. Others in this conversation have pointed out this is targeted for 9.5, though it may available as an extension before that.

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#144
post #77
post #49

I never really "got" the new wave of NoSQL databases. Mongo seemed to be the one I could most easily wrap my head around, but still. I was never sure, though, if that meant I had never faced a problem suitable for one of these DBMSs or if my mind is just so warped by years of using relational engines (mostly Postgres, or SQLite for simple projects) that I could not think of modeling my data any other way. Recently th…

I think people mix up three things: (1) Transactional model. Many NoSQL databases are non-ACID, but others are (Google's stores all have some transactional guarantees). Some databases try to gain efficiency by relaxing their transactional guarantees, some probably just didn't get around to implementing a proper transactional system yet. (2) Data model. The relational models can be overly restrictive as you cannot eas…

You don't need big data for (3), we use mongo sharding primarily for spreading database write load. Not saying that it's the best way to do that but it's what we use it for and I doubt we're the only ones.

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#145
post #97

Earlier quoted context omitted.

The entire narrative behind MongoDB in the first chapters of its evangelism was performance, partly due to its document-oriented approach (things are quicker in some scenarios when you get rid of relations, and it was contrast against the many tables approach), which is something that you can only very recently do in pgsql, and partly due to implementation choices like the dangerous default lack of fsync. Early evang…

I wonder if Node.js will follow the same fate...get a nice dose of reality check. It is mistakenly evangelized as also being faster, leaner, scalable, more concurrent than anything out there. Some clients would pay extra to redo CRUD using Node.js because it's "Asynchronous and We wanna Pay For Speed and Scalability".

My understanding is that people pick node.js because of simplicity and not for speed.

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#146
post #97

Earlier quoted context omitted.

The entire narrative behind MongoDB in the first chapters of its evangelism was performance, partly due to its document-oriented approach (things are quicker in some scenarios when you get rid of relations, and it was contrast against the many tables approach), which is something that you can only very recently do in pgsql, and partly due to implementation choices like the dangerous default lack of fsync. Early evang…

I wonder if Node.js will follow the same fate...get a nice dose of reality check. It is mistakenly evangelized as also being faster, leaner, scalable, more concurrent than anything out there. Some clients would pay extra to redo CRUD using Node.js because it's "Asynchronous and We wanna Pay For Speed and Scalability".

ASP & PHP servers don't have exceptional performance but they're 98% of the web

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#147

This benchmark misses the entire point of MongoDB: that you can atomically update individual fields in the document. Thas has not been possible with Postgres json storage type. Instead, the entire JSON blob must be read out, modified, and inserted back in. This reality is well known to those that understand Postgres, which is why they have HStore. HStore is limited though (particularly to the size of the store), so t…

Postgres has first-class arrays too: http://www.postgresql.org/docs/9.3/static/arrays.html

Can you atomically increase one element of that array by 2 without a big chunk of code?

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#148

Earlier quoted context omitted.

Could you confirm that you can atomically update a single item inside a jsonb field without reading/writing all of the jsonb data? I know this is possible with hstore (but not 9.3's json type), but can not find a clear answer for jsonb in the documentation. Any pertinent links would be much appreciated!

You can't. Others in this conversation have pointed out this is targeted for 9.5, though it may available as an extension before that.

I'm pretty sure you can using a stored procedure written with plv8. Though that's not exactly a fluent and elegant natural solution

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#149
post #69

This is very interesting. Around when MongoDB was quickly becoming the cool thing to do I'd ask people about why it is better than just storing things in Postgres. People would have answers that would be grammatically correct but would not make any sense. That being said, I find it weird that now it is cool to make fun of MongoDB. Some people on this thread have even said they want to know if a service is using Mongo…

> Stripe (who store your money related stuff in MongoDB) That's a bit scary. There has been several successful attacks against virtual currency exchanges that use MongoDB, utilizing the eventual consistency to your advantage. If you handle money, you don't want any inconsistencies in your database, no matter how temporary. You can work around these of course but you really need to know what you're doing.

> against virtual currency exchanges that use MongoDB, utilizing the eventual consistency

against solemnly depending on MongoDB's eventual consistency alone.

Re: PostgreSQL Outperforms MongoDB in New Round of Tests

#150
post #4

Only problem I have with JSON on Postgres is you can't update a property of a JSON object like so: update table set jsonCol->propertyA = 42; You need to write an extension for that. Easiest to do so using Python but sadly Heroku doesn't support python on postgres since its unsafe.

You can use PLV8 to do that in javascript on heroku.

You're right [0]. Thanks for the heads up.

[0] https://blog.heroku.com/archives/2013/6/5/javascript_in_your...

Post reply on HN