I am using SQL database for storage and my website is in c#, and both are on the same server.
I have inserted Students Result in a table in DataBase, which have fields like TestType, MAxMarks and MarksObtained.
Now i have to display complete result in one shot so i have to add maxmarks of all test types and marks obtained by students in those tests to display a final result.
My question is,
1) Should I fetch whole table from database and do all calculations in c# class?
or
2) I should do all calculations using t-SQL inside SQL server and then fetch the result?
Which of the above two scenarios is more server friendly? I do not want much load on server as database is huge with various simaltaneous login.
Which should be the ideal best practice in terms of load on server.?
Do it as part of the query. Let the database do the work in this case. If you have things indexed correctly it shouldn’t be a problem. If you fetch the whole table then you’re going to run out of memory.