I am creating a schedule for our engineer to analyze. The schedules are downloaded each day and the analysis is done on the local computers.
So, now, I am in this dilemma of storing the schedule in database as table rows or as nvarchar(max).
Here is the requirement
- The schedules are generated each day. Each schedule is accurate to 1 seconds. So, at most, it will contain 86,400 records per schedule.
- In a day, depending on the setting, the system can generate up to 100 schedules per engineer (we have a about 10 engineers)
- The schedule contains the following fields:
INT | INT | INT | INT | NVARCHAR(1024) | NVARCHAR(64) | BIT | BIT | DATETIME | DATETIME
(In summary: 4x INTs, 2x NVARCHARs, 2x BITs, and 2x DATETIMEs) - The schedule is rarely going to be updated, but it can be updated. The updatable fields are: 2x BITs and 1x DATETIME.
Now looking at the common case scenario:
In a day, it will generates about 1,296,000 records per day.
This is the calculation of common case scenario:
- 10 seconds accuracy per schedule = 8,640 rows
- 5 engineers run the scheduler each day
- Each engineer generates about 30 schedules
So total is: 8,640 * 5 * 30 = 1,296,000 records
If I store each schedule as NVARCHAR(MAX) with comma delimited, then the number of records are reduced to only 150 records per day.
Here is the calculation:
- 10 seconds accuracy per schedule = 8,640 rows --> stored as NVARCHAR (becomes 1 record)
- 5 engineers run the scheduler each day
- Each engineer generates about 30 schedules
So total is: 5 * 30 = 150 records
Now, this is the requirement for those schedules:
- The generated schedules can be viewed on the website.
- The schedules is downloaded by the application each day for analysis.
- The fields (2x BITs) can be updated once the analysis is completed. These fields can be updated by application (after finish analyzing the schedule) or can be updated (manually) by the engineer on the website.
- All generated schedule must be stored for at least 3 months for auditing purposes.
What is your recommendation? Store schedules as table rows OR NVARCHAR(MAX)