If you have millions of records, I would suggest you write part of the calculation in SQL Server, since calculations in Business Layer take significantly more time.
The following are recommendations for increasing productivity -
- Recording Stored Procedures
- Create Indexes for Quick Recordings
- Using temporary tables if manupulation for huge records
You can search the web to find other T-SQL performance optimization methods.
source share