5 ms·
This is wonderful work, and it is the foundation for yet more wonderful work in the future. However, as much as i am a huge PostgreSQL fanboy and a dedicated Mo
by twic 13y ago
This is wonderful work, and it is the foundation for yet more wonderful work in the future. However, as much as i am a huge PostgreSQL fanboy and a dedicated MongoDB peanut-thrower, i worry that the caption applied to this post is misleading.
Once this work is released, PostgreSQL will be faster than current versions of MongoDB at carrying out queries for documents which look for a given value at a given path (or perhaps more generally, values satisfying a given predicate at paths satisfying a given predicate).
But that has never been one of MongoDB's important strengths, has it? The operations for which MongoDB is optimised are inserting documents, retrieving document by ID, and conducting map-reduces across the whole database. Yes, it has the ability to query by values in leaves, and it can use indices to make that faster, but that's a bit of a second-tier, bag-on-the-side feature, isn't it? If that was the main thing you needed to do, you wouldn't have chosen MongoDB, right?
- rpedela 13y agoYou can insert and retrieve by ID just as fast with PostgreSQL. Map/reduce? Isn't that slow in general? Can't PostgreSQL JOIN and aggregate functions do most of what map/reduce is for but faster?
- driverdan 13y agoMongo clusters distribute map reduce so it can be reasonably fast.
- sudhirj 13y agoWhen map/reduce comes into play, speed isn't usually the main issue. It's a way to do work in parallel - which may be done to increase speed, but more often than not it's done because there's too much work to be done any other way. Put another way, I see map/reduce as a background task - building indexes, reporting, etc. I don't think speed is as important there as it is for a foreground task like GET, PUT and DELETE. For these operations, especially by key, Postgres has always been right up there - what's happening now is that Postgres is getting really good at NoSQL features - documents, key value pairs, deep querying etc - good enough that if you have Postgres you can do pretty much whatever you could have done with Mongo - while still making use of everything else it has to offer.
- afandian 13y agoI don't think Mongo map-reduce is parallel for a given instance.
- yummyfajitas 13y agoYou can insert and retrieve by ID just as fast with PostreSQL. How can postgres possible be faster on insert? Unlike Mongo, Postgres actually needs to write bytes to a disk (with a WAL!).
- masklinn 13y ago> Unlike Mongo, Postgres actually needs to write bytes to a disk (with a WAL!). Not with unlogged tables it does not!
- asdf3 13y agoOr just a single transaction with synchronous_commit! > Specifies whether transaction commit will wait for WAL records to be written to disk before the command returns a "success" indication to the client. > This parameter can be changed at any time; the behavior for any one transaction is determined by the setting in effect when it commits. http://www.postgresql.org/docs/9.3/static/runtime-config-wal.html#GUC-SYNCHRONOUS-COMMIT http://www.postgresql.org/docs/9.3/static/runtime-config-wal...
- masklinn 13y agoAnd you can set fsync off for extra yolo!
- clubhi 13y agoPostgres also has stupid mode option. (unlogged)
- rch 13y agoI think it's been referred to as 'running with scissors' mode actually.
- pilif 13y agoThe feature works per table and is off by default. Unlogged tables have another nice property: If the data gets corrupted somehow, then the table will be completely empty. This makes it clear to users that you'd use unlogged tables for caching or other data that you have no problem with losing. It also means that you can be sure that the data you read from an unlogged table is that data that you put there. I much prefer this over the possibility of maybe reading corrupt data without any possibility of detection. In my case, the use-case of an unlogged table is a table that practically works like a materialized view (until postgres learns to refresh them without an exclusive lock and maybe even automatically as the underlying data changes). If the table is empty, I can easily recreate the data, so I don't care about any kind of WAL logging or replication. If the table's there, perfect. I'll use it instead of a ton of joins and an equally big amount of application logic. If the data isn't there, well. Then I run that application logic which will cause the joins to happen. So that's way, way slower, but it'll work the same. The advantage of using an unlogged table here is that it's cheaper to update it and it doesn't use replication traffic (unlogged tables are not replicated).
- ddrmaxgt37 13y agoThe title will be changed soon. Don't worry.
- bramanga 13y agoIMHO this seems like building a better apple by making it taste like an orange. This could definitely be useful for storing json from javascript frameworks like backbone/angular/ember, but I don't see how this is going to improve the lives of PostgreSQL users in general. Hopefully this leads to some weird cool emergent use case that make PostgreSQL way better than other databases, but I'm not sure at this point that it will. Does anybody have more context on the long-game for this approach? I'm not sure what the goal is for adding this feature.
- garenp 13y agoLook at some of the linked PDFs. It's the indexing technique and on-disk format that is an enabler for several notable use cases; personally, I'm looking forward to a time when I can use pg for full-text search without having to resort to another external system like Lucene or Sphinx. What it won't have is the query "smarts" like Lucene or Sphinx do today, but you need speed first.
- baudehlo 13y agoPg's built in full text search works amazingly well and has all the smarts. It's also faster than lucene.
- rpedela 13y agoHuh? Please come up with about ten references (one isn't enough) to back up those claims.
- jeltz 13y agoI do not think so, but it might be after the GIN optimization work is committed. After it they beat Sphinx in several benchmarks. http://www.sai.msu.su/~megera/postgres/talks/Next%20generation%20of%20GIN.pdf http://www.sai.msu.su/~megera/postgres/talks/Next%20generati...
- baudehlo 13y ago
- mcgwiz 13y agoYou mischaracterize one of MongoDB's main draws. It's not just indexing, but indexing over a schemaless dataset. Mongo isn't unique in providing this, but combined with other features it is compelling for certain scenarios. That said, if Postgres matches/exceeds enough Mongo features, it could certainly outshine Mongo for those scenarios. AFAIK, map-reduce is relatively expensive on Mongo... typically recommended only for background execution, nothing synchronous.
- craigching 13y agoI've harped on this many times in the past. I love PostgreSQL, but where is its easy to replicate feature that matches MongoDB for ease of replication? Please answer "you must not be keeping up with PostgreSQL lately" and I'll eat my words! Easy replication ... that's why I use MongoDB.
- Lennie 13y agoSetting up a new PostgreSQL slave is just a one-liner with pg_basebackup in 9.3 (no outside tools needed): http://www.cybertec.at/postgresql-9-3-one-line-one-slave/ http://www.cybertec.at/postgresql-9-3-one-line-one-slave/