Hello! This isn’t really a Yii problem, but I didn’t really know in which other board to post this.
The problem is simple. I want to have a table where I save the user’s interaction in the application. For example…
Table name: access
columns: id_access BIGINT,id_user INT, date TIMESTAMP, ip VARCHAR, latitude VARCHAR, longitude VARCHAR
Each time a user does something like adding an item to a table (say, a product), updates, deletes, etc., the user’s action would be saved to this table for future reference. This log would be for many things like products, sales, etc., not just a single table.
[b]That was the problem. The following is my particular situation.
[/b]
Since the application will eventually become big, there are some issues I need to address. First, I’m considering not using MySQL for this log information, since it will eventually be huge and as far as I’ve read, MySQL may have some trouble with tables that have tons of rows (talking about 10,000,000+). I was thinking about trying MongoDB for the log information, though I don’t know much (if anything) about it yet, and it seems that it may make it harder to analyze the log data and compare it with the MySQL information. This comparisons will eventually be useful for business analytics in the application.
[b]I’m looking for suggestions about how to tackle this situation. This is what I came up with, but I’m not sure if it will work.
[/b]
The MongoDB solution would involve having the MySQL database exactly as it is, but move the log table into a MongoDB Collection where its humongous row size wouldn’t be troublesome.
There’s also the problem about logging the information correctly (as in, store which user deleted which item from the database). I was thinking that MongoDB could be useful in this case, too. Depending on what the users does (basically any CRUD), I could insert the appropiate information in the MongoDB collection for later retrieval. For example…
User creates an item - The MongoDB collection would have something like: id_access,id_user, date, ip, latitude, longitude, user_action (in this case, create), item_name, item_id, etc…
User deletes an item - The MongoDB collection would have something like: id_access,id_user, date, ip, latitude, longitude, user_action (in this case, delete), item_name, item_id, etc…
When deleting, the item would no longer exist in the MySQL database, but it wouldn’t matter since there would be no table relation inconsistencies in MySQL and the information in the MongoDB collection could eventually be used in conjunction with the information in MySQL to generate some interesting reports. I’m not exactly sure how this last part would work, so I’m just guessing there.
Does anyone have experience from a similar situation? Any suggestions on what to do? Alternatives?
Thank you for your time.