My plan's to develop a module for easy customer KPI handling across projects. It should consist of a small SDK to put 2-3 lines of code in the project, a "template"/model for a SQL table (code first DB) and a small frontend to see the most crucial things like clicks/item and so on.

I thought about storing everything in the same table - user, timestamp, action type and context (like item ids). As you can imagine it's pretty hard to do more complex calculations because context can differ.

Second approach - make tables per action type. This will make it hard to prepare a module because it differs from project to project.

What do you recommend? Are there any best practices on this topic?

1 Answer 1


Do both.

Have on big table for all actions, that stores information that is common to all or most of them.

Have separate tables for data that is specific to individual actions.

You might not need these separate tables for every action: perhaps some actions are relatively simple, and the big single table would be fine. But a few types of actions have much more complex data and need their own tables. If you do it this way, it would still be easy to add a new action type (as long as it is simple).

The details will depend on your specific requirements.

  • Sounds good, how would you identify them? action type-id?
    – Sandrooco
    Nov 29, 2016 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.