Tracking User activity log - SQL vs NoSQL? Tracking User activity log - SQL vs NoSQL? mongodb mongodb

Tracking User activity log - SQL vs NoSQL?


You are correct, main problem in any relational database is join.

So, you can create tracking system in mongodb or in mysql, just avoid joins:

So structure will be like this:

id activity_type - intuser_iddatefield1field2filed3

where activity_type (Signup = 1, CreatedPlaylist =2, ...)

To avoid join with user table you should add some user related data (data, that you need display, like first_name, last_name) to each activity row.

With provided above solution you can stay with mysql, and speed will same. Mongodb will be faster when you embedd in document many things, that you need join in relational database.


As a long-time Relational user, it seems to me the decision hinges on whether or not you have financial transactions or the tracking of physical goods. The "money and stuff" is what Relational was invented for. It is extremely good at it and maintains a very high standard of correctness.

However, when you do not have to balance books, or make sure you don't accidentally sell more widgets than you have, then use what you are comfortable with. Mongo, Couch, whatever.