Problem Statement
I have the following candidate key
{Student Id, Entity Id, Action Id......}
And I'm trying to decide whether I should use a composite primary key or a surrogate (auto increment integer or timestamp or guid) key.
Research & Analysis
I looked up up a couple of questions & discussions on stackoverflow but did not get a clear direction, specific to my scenario.
Should a composite key be e primary key
Compositve primary key or primary surrogate key
Here are the access patterns to the table
Write operations
The data gets stored into this table in response to Student actions in the web app; i.e. we can view it as time series data capturing the user actions on different entities. Over a period of time, I expect the number of concurrent students logged into the web app to be very high (depending on adoption of the product by the student population!). Im thus expecting a high number of concurrent writes, and a large table size over time.
Read operations
The table is to be accessed per student whenever a student logs in to the system to show him an overall summary of his past actions.
Planned Approach
Keeping in mind the access patterns, projected size of the table and the time series nature (events!) of the data, I'm more inclined towards using an unique surrogate key (auto increment integer), and a composite secondary key to get the best balance of write & read performance. The other alternative being, to create a composite primary key and avoiding a surrogate key.
Can you validate my approach or give your suggestions on alternatives or refinements to my approach?