I'm using Ruby on Rails 3 and MySQL.

During my project I must create a task-stream "module" to be able to save each user action information inside a devoted user table. That's, to produce a database table for every user.

Could it be a good idea to produce a database table for every (new registered) user during my application?

No, it's not a good idea. Why can you produce a separate tables with the same fields? Just add user_id for your table and store all info for each user inside.

I actually do such like, and you don't need to produce a whole table for every user. For instance, I've got a table known as "user_actions", as well as in it there's a column, "user_id".

The associations are:

User has_many :user_actions

UserAction belongs_to :user

And you are done. Allow the foreign-key relationship which comes naturally be mindful tying the particular action to some specific user.

Once you accomplish that, you only have to decide:

  1. Which actions cause an admission to be added in?
  2. How lengthy in the event you support the data (7 days, 6 several weeks)?

For instance, on my small site, I have a log from the last 5 things a person seen, and offer that list for them on the portion of the page known as "Lately seen products" for convenience.

I in addition have a separate table known as "admin_actions" which i use for security logging that monitors everything done under an admin account, and what admin account made what kind of change.

I suppose the reply is it is dependent on the number of customers you will find. When not a little, defined number then I'd claim that it's not recommended to produce one table per user.

I'd advise a single table with one column as being a unique identifier for that user. Make certain any time you are querying the table that you are utilizing an index which has this column because the first column within the key. E.g. PRIMARY KEY(user_id, activity_time)

This will permit fast and efficient reading through from the rows.