I am working on a medical software and my goal is to store lots of custom actions to database. Since it is very important to keep track who has done what, an action is generated every time user does something meaningful (e.g. writes comment, adds some medical information etc.). Now the problem is that over time there will be lots of actions, let's say 10000 per patient, and there might be 50000 patients, resulting in total of 500 million actions (or even more).
Currently database model looks something like this:
[Patient] 1 -- 1 [ActionBlob]
So every patient simply has one big blob which contains all actions as big serialized byte array. Of course this won't work when table grows big because I have to transfer the whole byte array all the time back and forth between database and client.
My next idea was to have list of individually serialized actions (not as a big chunk), i.e
[Patient] 1 -- * [Action]
but I started to wonder if this is a good approach or not. Now when I add new action I don't have to serialize all other actions and transfer them to database but simply serialize one action and add it to Actions table. But how about loading data, will it be superslow since there may be 500 million rows in one table?
So basically the question are:
- Can sql server handle loading of 10000 row from table with 500 million rows? (These numbers may be even larger)
- Can entity framework handle materialization of 10000 entities without being very slow?