News for hackers. Stuff that matters.
Re:Things I wish I knew about MongoDB a year ago by dia80 on Wednesday October 17, 2012 @06:16PM (#4666666)
Genuine question:

In what use cases does mongo kick mysql's ass?

I've used it a couple of times in hobby projects and enjoyed not maintaining a schema. I read so many of these 'gotcha' style articles and for example one commenter here wants to have a manual "recently dirty" flag to combat the master / slave lag mentioned in the article. I know it's faster (tm) but once you have to take in to account all this low level stuff you have to worry about yourself wouldn't it just be better to rent/buy another rack of mysql servers and not worry about it?

Look forward to learning something...

Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Wednesday October 17, 2012 @06:40PM (#4666740)
MongoDB kicks ass in the following situations (real projects I did as a freelancer):

- dealing with semi-structured input (forms with some variability) and storing as a document, all while being able to query across the data

- used as a store to provide very flexible ETL jobs (with ability to upsert, filter/query, geonear etc)

For those situations, I would definitely use MongoDB again. As a RDBMS replacement, I wouldn't use it today.

Re:Things I wish I knew about MongoDB a year ago by dude_abides on Wednesday October 17, 2012 @07:10PM (#4666817)
To slightly rephrase the OP's question:

  In what use cases does mongo kick postgres's ass?
To the two points you mentioned:

- semi-structured input can be saved as hstore type or as json type;

- and for flexible jobs, you can use pretty much any popular language - PL/R, PL/Python, even PL/C if performance is really critical.

Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Thursday October 18, 2012 @03:25AM (#4667789)
I would have replied something similar if that was the question :-) (I use PG a lot these days).

Agreed on the first point (but I'm not sure you get exactly the same type of flexibility in all my use cases - I'll have to make a closer comparison).

For the second point, well not having to handle the schema for ETL jobs is sometimes fairly useful and removes a lot of cruft, that was part of my point (those ETL are code-based, only relying on MongoDB as a flexible store).

Re:Things I wish I knew about MongoDB a year ago by d0ugal on Thursday October 18, 2012 @06:15AM (#4668124)
You can't query JSON easily and hstore is only one level deep. So, no, its not as flexible.
Re:Things I wish I knew about MongoDB a year ago by niels on Thursday October 18, 2012 @04:43AM (#4667941)
You can't query the json type as easily in postgres. I would guess that is an important use case.
Re:Things I wish I knew about MongoDB a year ago by jalada on Thursday October 18, 2012 @03:34AM (#4667806)
I don't know about JSON type but the annoying thing about hstore is everything is a string; there are no types.
Re:Things I wish I knew about MongoDB a year ago by taligent on Wednesday October 17, 2012 @10:11PM (#4667189)
Just because you can write an app using assembler doesn't mean it is the best way to do it.
Re:Things I wish I knew about MongoDB a year ago by dude_abides on Wednesday October 17, 2012 @11:23PM (#4667356)
Very tempted to ask "In what way does postgres compare to an assembler and mongodb to a high level language?" but I think I'll just assume that you're trolling.

Besides, SQL sounds more high-level than map-reduce to me.

Re:Things I wish I knew about MongoDB a year ago by olalonde on Thursday October 18, 2012 @12:27AM (#4667492)
For those like me who have no ides what ETL stands for: https://en.wikipedia.org/wiki/Extract,_transform,_load
Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Thursday October 18, 2012 @03:27AM (#4667792)
Thanks for pointing that out!

Here is a presentation (slides + video) I gave about a Ruby ETL, for instance. It illustrates the typical use cases I run into.

http://lanyrd.com/2012/rulu/swxtt/

Re:Things I wish I knew about MongoDB a year ago by jandy on Wednesday October 17, 2012 @06:55PM (#4666779)
To elaborate on the semi-structured input point: Monogo and it's kin are great for EAV systems (http://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%...), where your entities can have an arbitrary number of fields (often user defined). Trying to build this kind of system in a traditional RDBMs can be quite tricky.
Re:Things I wish I knew about MongoDB a year ago by sgolestane on Wednesday October 17, 2012 @07:15PM (#4666832)
Since we are a mysql shop, for this use-cases I serialize and store the form as xml in a CLOB column. For any field that needs to be searched on, I create an additional column. Disadvantage of this is you can't run mysql queries against the data stored in the CLOB column.
Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Thursday October 18, 2012 @03:28AM (#4667793)
Adding column per searchable field is precisely what I wanted to avoid :-)

If you need to store multiple forms types, it gets hairy very fast.

MongoDB allows to query inside the data (which is not a blob in that case).

Re:Things I wish I knew about MongoDB a year ago by jeltz on Thursday October 18, 2012 @07:06AM (#4668225)
So does PostgreSQL, but I have no idea about MySQL. You can run xpath queries against XML documents, and you can also index specific xpath queries (there is no general indexing infrastructure for XML in PostgreSQL). For JSON no path lookup functions are included in the core yet, but I assume there are extensions which add them.
Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Thursday October 18, 2012 @03:30AM (#4667800)
Thanks for elaborating! This is much needed and spot on :-)

A long while back I built a somewhat complex survey app: I can confirm it's fairly more complicated to handle with a RDBMs, compared to a document store.

Re:Things I wish I knew about MongoDB a year ago by joevandyk on Wednesday October 17, 2012 @07:15PM (#4666833)
fwiw, postgresql 9.2 supports a json datatype. you can efficiently access/query json fields using plv8 (http://code.google.com/p/plv8js/).

so you could have:

  create table form_results (                                                                                
    id serial primary key,                                                                            
    data json                                                                                         
  );
http://pgeu-plv8.herokuapp.com/ has more information.
Re:Things I wish I knew about MongoDB a year ago by jvehent on Wednesday October 17, 2012 @08:57PM (#4667057)
It's just a JSON syntax validator. You can't index on part of the json, postgres treats it as a string.

You can apply full text search on it, but that doesn't tell you if you're matching on a key or a value.

Re:Things I wish I knew about MongoDB a year ago by ismarc on Wednesday October 17, 2012 @09:44PM (#4667136)
In postgres, you can index on a stored procedure, so you can use a simple stored procedure written in JavaScript to look up by key and return values, etc. Example available at http://people.planetpostgresql.org/andrew/index.php?/archive...
Re:Things I wish I knew about MongoDB a year ago by vidarh on Wednesday October 17, 2012 @08:16PM (#4667001)
Very interesting presentation, though the title of "heralding the death of nosql" is either intentionally exaggerating, or indicates the author doesn't understand all the reasons why people go to nosql databases. In fact, the presentation demonstrates why: Postgres has tons of really fantastic, awesome features that next to nobody uses because they are hidden behind layers of SQL-type incantations and/or require various extensions.
Re:Things I wish I knew about MongoDB a year ago by gbog on Wednesday October 17, 2012 @08:29PM (#4667021)
So you'd rather install a completely new storage engine and learn to use it than check a doc and install an extension to postgres?
Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Thursday October 18, 2012 @03:33AM (#4667805)
The thing is that 10gen did a really, really good job at polishing the install process and documenting it to get people started.

No surprise to see the GIS part of MongoDB is built-in instead of an extension of some kind. I know a couple of people who used PG without even knowing there was a GIS extension.

Re:Things I wish I knew about MongoDB a year ago by jeltz on Thursday October 18, 2012 @07:01AM (#4668217)
But on the other hand PostGIS being independent from PostgreSQL has resulted in the best opensource GIS database. And with the recent addition of CREATE EXTENSION the PostgreSQL extension installation process has been heavily streamlined. Before CREATE EXTENSION it was a mess for larger extensions.
Re:Things I wish I knew about MongoDB a year ago by thibaut_barrere on Thursday October 18, 2012 @09:54AM (#4668733)
PostGIS is miles, miles ahead, for sure! Yet even "create extension" sounds a bit weird to most newcomers (me included at first!), especially against "built-in basic GIS".
Re:Things I wish I knew about MongoDB a year ago by ibotty on Thursday October 18, 2012 @04:23PM (#4670860)
is it a good thing to have everything built in?
Re:Things I wish I knew about MongoDB a year ago by amalag on Wednesday October 17, 2012 @09:34PM (#4667122)
I don't quite understand how the transition happened from no-json support to json support in those slides. How did the plv8js do this searching on fields?
Re:Things I wish I knew about MongoDB a year ago by alexro on Wednesday October 17, 2012 @06:22PM (#4666682)
IMO there is no rational explanation to this phenomena other than: people are different. Some get bored with stored procs and want same hassle but in another form.
Re:Things I wish I knew about MongoDB a year ago by morsch on Wednesday October 17, 2012 @06:32PM (#4666713)
A cynical but insightful description of many kinds of progress and change. ;)
Re:Things I wish I knew about MongoDB a year ago by taligent on Wednesday October 17, 2012 @10:07PM (#4667181)
Yes. There is no rational explanation for people using the right tool for the right job.

Let me guess. You would build a skyscraper using a trough and cement in a bucket ?

Re:Things I wish I knew about MongoDB a year ago by jamesaguilar on Wednesday October 17, 2012 @11:33PM (#4667389)
Are you trying to give us an idea of what it's like to build an even moderate sized app without transactional consistency and with mapreduce? Because that is what it sounds like to me.
Re:Things I wish I knew about MongoDB a year ago by elchief on Wednesday October 17, 2012 @07:48PM (#4666918)
When you have so many writes that sharding isn't enough.

When you make changes so fast you need a liquid schema.

When you want to make your boss learn map-reduce so he can query the data.

When the application can take care of integration and not the database itself.

Re:Things I wish I knew about MongoDB a year ago by leif on Wednesday October 17, 2012 @08:07PM (#4666979)
This will be obvious, but I work at Tokutek.

> When you have so many writes that sharding isn't enough.

TokuDB does indexed insertions very fast. [1] We've even plugged ourselves in underneath MongoDB (just for fun) and we beat them too. [2]

> When you make changes so fast you need a liquid schema.

TokuDB supports lots of schema changes with zero downtime. [3]

> When you want to make your boss learn map-reduce so he can query the data.

Can't help you there, but I can make you not need to torture your boss that way.

> When the application can care of integration and not the database.

What if it didn't need to?

We also get fantastic compression [4], retain full transactional semantics, and lots of other fun stuff.

Email us if you're curious!

[1]: http://www.tokutek.com/resources/benchmark-results/benchmark...

[2]: http://www.tokutek.com/2012/08/10x-insertion-performance-inc...

[3]: http://www.tokutek.com/resources/benchmark-results/benchmark...

[4]: http://www.tokutek.com/resources/benchmark-results/benchmark...

Re:Things I wish I knew about MongoDB a year ago by DanWaterworth on Thursday October 18, 2012 @02:48AM (#4667722)
In my experience, it's not just throughput that's important, but also 99th percentile latency. If I understand fractal trees correctly, you sometimes need to rewrite all of your elements on disk. How do you do this without causing lag?
Re:Things I wish I knew about MongoDB a year ago by leif on Thursday October 18, 2012 @07:24AM (#4668274)
That's happily not how fractal trees work, at all. We have a few talks online describing how they work. Zardosht has one here http://vimeo.com/m/26471692 . I thought Bradley had a more detailed one at MIT but I can't find it right now. (EDIT: found it! http://video.mit.edu/watch/lecture-19-how-tokudb-fractal-tre...)

Basically, I think you're thinking of the COLA. What we implement does have a literal tree structure, with nodes and children and the whole thing, so at any point you're just writing out new copies of individual nodes, which are on the order of a megabyte. At no point do we have to rewrite a large portion of the tree, so there aren't any latency issues.

Re:Things I wish I knew about MongoDB a year ago by DanWaterworth on Thursday October 18, 2012 @11:31AM (#4669223)
Thank you very much for the links. Is my understanding correct?

Essentially, a fractal tree is a B-Tree (or perhaps a B+Tree?) with buffers on each branch (per child). Operations get added to these buffers and when one becomes full, the operations get passed to the corresponding child node. Operations are applied when they reach the node that is responsible for the data concerned.

Re:Things I wish I knew about MongoDB a year ago by leif on Thursday October 18, 2012 @12:32PM (#4669515)
That's about it! It's like a B+Tree in that the data resides in the leaves (well, and in the buffers), except that the fanout is a lot lower because we save room in the internal nodes for the buffers.
Re:Things I wish I knew about MongoDB a year ago by alex137 on Friday October 19, 2012 @05:01AM (#4672779)
Hi. I thought the block size is much bigger in fractal trees (like 4MiB instead of 4KiB) than in B-trees hence the fanout would be about the same?

I'm trying to experiment with these ideas on my side, but can't quite grok how large the buffers must be at each level of the tree.

Let's take a concrete example like: 2^40 (1T) records with an 8-byte key and an 8-byte value. In a traditional B-tree with a 8KiB block size and assuming links take 8 bytes too and assume for a while that blocks are completely full. So, that's 1G leaf blocks, a fanout of about 1K and hence & full 4-level trees: 1 root block, 1K level-2 blocks, 1M level-3 blocks, 1G leaf blocks.

In this setting, I understand that a fractal tree will attach a buffer to each internal node. How large will they be at level 1 (root), level 2, and level 3 ?

Re:Things I wish I knew about MongoDB a year ago by leif on Friday October 19, 2012 @07:01AM (#4672998)
The buffers have the same capacity at each level of the tree. It doesn't have to be that way, and you can find different strategies in the literature, but that's the way we do it.

The degree of each internal node is way lower, because we want to use the space in internal nodes for buffers more than for keys. In a 16TB tree, we would probably have a tree of height 6 or 7.

What we restrict is the size of a whole internal node, so that any one buffer in it can get much more full than the others if it needs to. We want to pick a node size that makes sense for your media. 4MB is a good compromise for spinning disks between their typical bandwidth and seek time, and it's large enough to give the garbage collector a rest on SSDs.

Re:Things I wish I knew about MongoDB a year ago by alex137 on Monday October 22, 2012 @12:02PM (#4683749)
OK, I'm starting to get the concept. Here is how I'm understanding the whole thing:

Assume a node size that can hold 1M records in a buffer and 32 links (that's about 16 MiB more or less, more than what you suggest, but it simplifies the explanations).

Assume further that to operate on a node, you read it entirely in memory, modify it, sort it, then write it entirely on disk and that that takes about 1 second. This is pessimistic as there are surely more efficient ways to maintain sorted 1M nodes.

Now consider completely random insertions or 16-byte records and assume that the keys will spilt completely uniformly among the subtrees.

1. Every 1M insertions, you need to spill from level-1 (root buffer) to level-2, which generates about 32 IOs 2. Additionnally, every 32M insertions, you need to spill all level-2 buffers to level-3, which generates 3232 IOs n. every 32^(n-1) M.insertions, you need an additional 32^n IOs to spill from level-n to level-(n+1)

So, all in all, to insert 32^n M.records, you need a total of (n+1)32^(n+1) I/Os, which means 32(n+1) IO per 1M insertions.

For example, in a 16TiB data store, i.e. with n=8, you need 288 IOs per million insertions, or about 2400 random insertions/second at 1s/random IO.

In comparison, a B-Tree with a fanout 1024 and a block size 16KiB would generate about 4 random IOs per insertion. These IOs would be dominated by the seek time (~10ms), so you could get only 25 insertions per second.

On the other hand, a point query in this B-Tree would take 4 IOs instead of 8 random I/Os in the fractal tree. So, that's the tradeoff: much better insertion rate vs. slightly worse query time.

Note that a small fanout (about square root of the equivalent B-tree fanout) is important. If you take 1024 as fanout in the fractal tree, the tree has half the height, but the number of IOs per 1M insertions drops to 10245 instead of 32*9.

Have I got it right?

Re:Things I wish I knew about MongoDB a year ago by leif on Monday October 22, 2012 @05:07PM (#4685542)
The argument I like goes like this:

Flushing one buffer one level down costs O(1) I/Os. It moves B elements, so flushing one element one level down costs O(1/B) amortized I/Os. The tree has fanout O(1), so it has height O(log N). Therefore, each element must be flushed O(log N) times before it reaches its target leaf. So the cost to get one element down to its leaf is O((log N)/B) amortized I/Os.

Compare this with a B-tree, which costs O(log_B N) = O((log N)/(log B)) per insertion.

I'm pretty sure your math is right, though it attacks it from the other direction and I've only just skimmed it. It seems sound though.

The point query tradeoff is there in the theory, you're right, but it assumes a cold cache. In practice, most people have enough RAM for all their internal nodes, whether they're using a B-tree or a fractal tree, so either way it's typically 1 I/O per random point query in either data structure.

Be careful with asterisks here. :)

Re:Things I wish I knew about MongoDB a year ago by alex137 on Tuesday October 23, 2012 @11:57AM (#4688665)
Good.

Now, what is the recommanded layout of the node buffers (the 4MiB buffers). I've read about Packed Memory Arrays, but don't quite get the complete idea. Can we really do better than read, merge, write ?

(A pity there's no preview button on this forum...)

Re:Things I wish I knew about MongoDB a year ago by leif on Tuesday October 23, 2012 @01:18PM (#4689088)
Unsorted is fine, we're just counting I/Os, and it takes O(1) I/Os to read or write a buffer regardless of the layout.
Re:Things I wish I knew about MongoDB a year ago by leif on Friday October 19, 2012 @07:05AM (#4673005)
I should add that, to reduce the cost of a flush by a pretty decent constant number of I/Os, you keep one buffer per child in each node. Basically, you want to do the sorting work on arrival into the node, not during the flush.
Re:Things I wish I knew about MongoDB a year ago by DanWaterworth on Thursday October 18, 2012 @01:20PM (#4669791)
I'm a little confused. I thought fractal trees worked cache obliviously or am I mistaken?
Re:Things I wish I knew about MongoDB a year ago by leif on Thursday October 18, 2012 @02:03PM (#4670081)
In theory, it is cache oblivious, and the CO-DAM model informs our decisions about the implementation, but no, the implementation itself isn't actually cache oblivious. Shh, don't tell on us.

A "fractal tree" is defined by our marketing team as "whatever it is we actually implement." If you want to talk cache-oblivious data structures, we can talk about things like the COLA and cache-oblivious streaming B-trees which have rigorous definitions in the literature. At some point, if you want to achieve a certain level of detail, you have to pick one or the other in order to continue the conversation.

Re:Things I wish I knew about MongoDB a year ago by stinkypete on Saturday October 20, 2012 @08:00PM (#4678502)
Sounds like a Y-Tree to me: "A Novel Index Supporting High Volume Data Warehouse Insertions," C. Jermaine et. al, VLDB '99.

How are fractal trees different?

Re:Things I wish I knew about MongoDB a year ago by leif on Monday October 22, 2012 @05:11PM (#4685559)
Is that the same as Willard's Y-fast tree? If so, then no they're not very similar. If not then I'm unfamiliar and I should read that paper.
Re:Things I wish I knew about MongoDB a year ago by stinkypete on Wednesday October 24, 2012 @01:13PM (#4693897)
Nope, not the same. From the descriptions you give above it is very similar (a modified B-tree with heaps of delayed insertions in internal nodes), though the analysis in the paper does not use CO techniques.

This tweak to B-trees to support fast insertions works so well I am really surprised it has not become more common in practice. The only downside I can think of is that flushes down the tree when internal buffers get large may cause lower-level pages to become overfull, but if you allow more than one flush operations at each level you can avoid this problem. Of course, that's only important if you are paranoid about internal nodes actually fitting in a page; if you don't care about that, then the worst-case analysis picture looks much better since a flush operation causes at most one flush in the pages immediately below it in the tree structure.

Re:Things I wish I knew about MongoDB a year ago by leif on Wednesday October 24, 2012 @06:42PM (#4695398)
I was surprised too, when I learned this technique, that people weren't already doing it. I think it's just an age thing. B-trees are old so they have all the kinks worked out, at least in mature implementations. Fractal trees are new enough that there are still a bunch of tradeoffs to play with and evaluate.

When you actually go and implement the system, you find all these behaviors that really aren't expressed in the theory. There are lots of things we're still experimenting with. Flushing isn't too hard, if a flush makes another node way too big, you can just flush that one too. We don't allow our cascading flushes to fan out, to prevent latency-style problems, but they can flush all the way down to a leaf. There are some other fun problems around query strategies and concurrency control too. It's definitely a fun structure to play with.

Re:Things I wish I knew about MongoDB a year ago by lwat on Wednesday October 17, 2012 @07:57PM (#4666950)
> When you have so many writes that sharding isn't enough.

Does Mongo still have a global write lock?

Re:Things I wish I knew about MongoDB a year ago by elchief on Wednesday October 17, 2012 @08:02PM (#4666961)
no longer (but only a few months)
Re:Things I wish I knew about MongoDB a year ago by mgummelt on Wednesday October 17, 2012 @09:14PM (#4667089)
Though I believe it still has a per-collection lock.
Re:Things I wish I knew about MongoDB a year ago by Jare on Wednesday October 17, 2012 @09:49PM (#4667146)
It has per-database locking. Per-collection is being worked on but no planned date yet. [1]

[1] http://www.mongodb.org/display/DOCS/How+does+concurrency+wor...

Re:Things I wish I knew about MongoDB a year ago by diminoten on Wednesday October 17, 2012 @06:37PM (#4666729)
Mongo isn't so important to this question as ODB vs RDBMS. Here's some light reading:

http://en.wikipedia.org/wiki/Object-relational_impedance_mis...

MongoDB is just ODB, and MySQL is just RDB.

Besides, postgres is the real future!

Re:Things I wish I knew about MongoDB a year ago by dleblanc on Wednesday October 17, 2012 @07:25PM (#4666859)
Not sure what Wu-Tang has to do with this, but....

Seriously though, is Mongo an ODB, or a document oriented database? ODBs/OODBs imply a much different use-case and functionality, and I think we ought not conflate the two.

Re:Things I wish I knew about MongoDB a year ago by ww520 on Wednesday October 17, 2012 @09:34PM (#4667121)
Mongo is not an ODB in the traditional ODB sense. Mongo is just a document (or blob) database. ODB supports relationship, link traversal, inheritance, etc. Basically the whole shebang of the OO notions in a database.
Re:Things I wish I knew about MongoDB a year ago by diminoten on Friday October 19, 2012 @06:12AM (#4672906)
You're right, I didn't know there was a difference.
Re:Things I wish I knew about MongoDB a year ago by taligent on Wednesday October 17, 2012 @10:03PM (#4667171)
PostgreSQL is the PAST and it will forever remain there until it solves its biggest problems.

It is the hardest out of all databases I've used to cluster, replicate, shard and manage. And the database world is moving towards scaling horizontally rather than vertically. I can push a button in say CouchDB to replicate and shard. Try doing that in PostgreSQL.

Re:Things I wish I knew about MongoDB a year ago by jeffdavis on Thursday October 18, 2012 @02:17AM (#4667673)
"And the database world is moving towards scaling horizontally rather than vertically."

I think that's an oversimplification. Two counterpoints:

* Database systems will always need to make heavy use of locality. The speed of light means that synchronizing access over long distances (even medium distances -- light only goes about a foot per nanosecond) will always be a challenge.

* Multi-core means vertical scaling is back in (if by "vertical scaling" you mean "scaling on one box"), and probably for a while.

Postgres is doing an excellent job at both.

I do agree with the less-exaggerated point that postgres really needs to improve its multi-machine scaling. But it's far from a solved problem on any system under discussion.

Re:Things I wish I knew about MongoDB a year ago by andyzweb on Thursday October 18, 2012 @08:13AM (#4668385)
postgres does horrible with multicore unless you have many concurrent pooled connections. fork-and-forget
Re:Things I wish I knew about MongoDB a year ago by jeffdavis on Thursday October 18, 2012 @10:37AM (#4668940)
I think you're referring to postgres's inability to use more than one core per query, which is true (or mostly true... there are quite a few helper processes that take on some of the work).

For many smaller queries, postgres does great on multi-core, and pgbouncer is a good connection pooler.

Re:Things I wish I knew about MongoDB a year ago by true_religion on Thursday October 18, 2012 @01:39AM (#4667615)
People still use SQLlite. Why? Because its suits a specific set of circumstances.

Postgres does the same---its an incredibly powerful database with a large suit of features that make application development both easy and sane. To the vast majority of projects where you won't outgrow a single server, it makes sense to use it.

Re:Things I wish I knew about MongoDB a year ago by np422 on Thursday October 18, 2012 @04:39AM (#4667927)
You have obviously never used Oracle RAC .. :)
Re:Things I wish I knew about MongoDB a year ago by jeremyjh on Thursday October 18, 2012 @09:13AM (#4668568)
One issue with MySQL in large databases is that schema changes are extremely expensive, so much so that you'll be making design decisions around it (e.g. how do we implement this feature without executing our two-day alter table statement). Not all RDBMS have this problem to such a degree but none can escape it entirely.

A lot of the gotchas that he notes are related to design trade-offs with different default behavior than an RDBMS typically would have. For example as your system gets large enough in MySQL you may find you have to do asynchronous replication as well, and then you will have similar problems with dirty reads.

Re:Things I wish I knew about MongoDB a year ago by bsg75 on Thursday October 18, 2012 @12:42PM (#4669547)
> e.g. how do we implement this feature without executing our two-day alter table statement?

With MySQL being so prevalent, IMO this is the principal reason why the concept that RDBMS' are hard to work with exists. None of the other major platforms have this issue, but if a developer's only exposure is to MySQL, then the idea of schema alters are always fearsome.

This is not to say that ALTER TABLE statements are always quick - if constraint checks or default values are included, there can be long runtimes in PostgreSQL, MSSQL, Oracle, etc. - but significant downtime to add an empty nullable column is just plain stupid for a platform that has been around as long as MySQL.

MySQL has forced a major population segment of developers to toss the advantages of DB side validation and rich query languages for the purpose of _avoiding_MySQL_. Sure the whole object-relational impedance mismatch exists, SQL is hard, yada-yada, but I have never seen these reasons cause as much angst as taking a service offline to add a column to a table.

10gen should have a picture of Monty in their CFO's office.

Re:Things I wish I knew about MongoDB a year ago by mrkurt on Wednesday October 17, 2012 @07:34PM (#4666879)
Eventually consistant replication is not unique to MongoDB, most DBs have an async replication option. Using "not Mongo" won't really solve it.
Re:Things I wish I knew about MongoDB a year ago by krichman on Wednesday October 17, 2012 @11:43PM (#4667409)
An option is not a default, though, so using Postgres or MySQL absolutely would solve the problem of returning with success before persisting the data.

The contentious area isn't really that Mongo does this, it's because for whatever reason the people trying it don't expect Mongo to do this.

Re:Things I wish I knew about MongoDB a year ago by untog on Wednesday October 17, 2012 @07:12PM (#4666826)
I think there are legitimate reasons to use a "NoSQL" solution rather than MySQL. I'm more interested to know in what use cases Mongo kicks it's competitors asses? What are it's competitors, even? I'll admit that the NoSQL world is a slightly blurry mess to me, with different products seemingly optimised for different cases.
Re:Things I wish I knew about MongoDB a year ago by taligent on Wednesday October 17, 2012 @10:00PM (#4667165)
MongoDB is a JSON document store. Almost all other NoSQL are key/value type stores.

If you have a use case that centres around storing document style data then MongoDB will be better suited.

Re:Things I wish I knew about MongoDB a year ago by trustfundbaby on Wednesday October 17, 2012 @11:12PM (#4667319)
not to be persnickety but its a BSON document store. Theres a difference.
Re:Things I wish I knew about MongoDB a year ago by mattparlane on Wednesday October 17, 2012 @07:11PM (#4666821)
My number one reason for choosing MongoDB is replication that just works out of the box and doesn't require either a read lock or shutting down the master to set up a new slave.
Re:Things I wish I knew about MongoDB a year ago by sausagefeet on Wednesday October 17, 2012 @07:36PM (#4666885)
As far as I can tell, Riak blows mongo away for this particular criteria.
Re:Things I wish I knew about MongoDB a year ago by mattparlane on Wednesday October 17, 2012 @08:27PM (#4667019)
That's my understanding too, but MongoDB hit the sweet-spot for us, Riak couldn't handle the raw queries-per-second we needed without requiring extra hardware ($$).
Re:Things I wish I knew about MongoDB a year ago by jaimebuelta on Thursday October 18, 2012 @02:46AM (#4667719)
But Riak is much limited on the queries you can run.
Re:Things I wish I knew about MongoDB a year ago by jeltz on Thursday October 18, 2012 @07:21AM (#4668267)
Serious question: What database requires read locks or shutting down the master for setting up a new slave? Is it MySQL?

Both sounds like really weird requirements for replication which defeats half the purpose of having it. PostgreSQL has never had any of these two problems. Still working on improving usability but with the addition and improvements of pg_basbackup I would say it is almost there. Hopefully 9.3 will get timeline switching to simplify failover.

Re:Things I wish I knew about MongoDB a year ago by mrinterweb on Wednesday October 17, 2012 @07:40PM (#4666892)
Map reduce across sharded servers comes to mind as an advantage. For that matter, horizontal scalability in general is a big advantage that many of the NoSQL data stores have over RDBMS databases.