11/21/2010

Is MySQL the new SPAM of the modern?

Do you remember this wonderful SPAM sketch by Monty Python Flying Circus?

They say, that's why they call the emails we don't want to receive the SPAM. However, here is a nice story which illustrates what I wat to say in this blog post.

Recently, a former colleague told me he's in a project as architecture consultant. There is also a customer and a consulting company who will do all the implementation. A triangle. So, the customer wants a thing to be implemented where they would have many information nodes which would be linked together based upon different criteria, and you never know in advance how long the path between A and B would be. The primary requirement is to later find the shortest path from A to B.

Sounds simple, doesn't it? Or not? Well, this is a classic use case for graphs, if you didn't have to deal with such scenarios before. And usually it is very difficult or almost impossible to save such paths using a relational database, at least if you want to find the shortest path real quick. You would need to read all the data into the memory to be real fast, and if there is real big data you have to deal with, you simply have no chance to do so.

That's why some real smart guys have implemented graph databases such as Neo4j. The database has exactly one group of use cases it deals with and nothing else. It doesn't try to rule the whole world - it just does it's job well.

Now, the triangle I've mentioned earlier comes together and discusses the future solution.

The architecture consultant says: you should do it with a graph database since the data is huge and it's going to grow unpredictably.

The customer has no idea about all that but needs two opinions to pick the cheapest one.

The consulting company says: we take MySQL. It's cheap, it's mainstream, we are experienced in it, we can do it in 5 days. But we would have to limit the path length to 5 nodes per path.

Now think back to the SPAM sketch and compare :)

"Do you have anything without MySQL in it?" - "Hm, we have a solution with just a little MySQL in it" - "But I don't want MySQL!" - "MySQL, MySQL, MySQL, MySQL......"

2 comments:

Warren Davidson said...

MySOL is the database equivalent of SPAM? :) Too funny. I'm seeing the trend to be something like Mongodb or Cassandra with a graph database, covers the big data and the relationships well together. Good article, would be good to see how people are architecting some of these polyglot systems.

Pavlo Baron said...

It just should be the right tool for the job. It is pity to always hear the same answer to all technical questions, especially when this answer is sometimes really wrong...