It’s just come up in my mind that I want to prove the performance difference between MySQL and MongoDB, so I started this research. It took almost 2 days (I waste a lot of my time in importing a lot of data) and the conclusion is MongoDB is faster than MySQL and it’s about 50% faster. Okay, let’s say ‘wow’ together, “woooooow!”. It might be some of you already known about this fact, but this is my first time in proving the performance between to technologies and I felt so ecstatic!
Now let me tell you the environment that I use for this test. I use Ruby on Rails 3.2.8, MySQL 5.1.44, mysql2 gem (0.3.11), mongoid gem (3.0.14), and MongoDB (2.2.0). My plan is to see which one has the better performance in solving the N + 1 Query Problem, so I prepared 2 tables of data which are containing a quite lot amount of data. Table hotels (the main table) has 4,450 rows of data and Table hotel_reviews (the child table) has 75,650 rows of data.
The tools are prepared and let’s start our test, first from MySQL then we continue to MongoDB. Continue reading “Simple Test : MongoDB vs MySQL”