Code performance: SQL Server Query vs C#.Net web application

asp.net, c#, performance, sql-server

Solution

If you have millions of records then I would suggest you to write calculation part in SQL Server as calcuations in Business Layer will significantly take more time.

Following are suggestions to improve performance -

- Write Stored Procedures

- Create Indexes to fetch records faster

- Use of temp tables if manupulation is for huge records

You can search on net to find out T-SQL other performance optimization techniques.

Problem

I am writing a complex logic to calculate sales and customer bonuses. I have million of records to calculate bonuses. I want expert opinions so that mathematical operation don't take much time to display result on web page. So where I need to write calculation part? In SQL Server Queries (Using Stored Procedure and functions) or ASP.NET & C#.Net (Business Logic layer)? Which one is the best practice? Processing on Database server or Processing on Application server? Regards Mohsin JK

Original source