We are creating a new application in .net 3.5 with a SQL Server database. The database is quite large, with about 60 tables with data load. The .net application has the functionality to transfer data to this database from data entry and from third-party systems.
After all the data is available in the database, the system must perform many calculations. The logic of the calculation is quite complicated. All data necessary for the calculations are in the database, and the output also needs to be stored in the database. Data collection will occur every week, and the calculation should be performed every week to create the necessary reports.
Due to the above scenario, I thought of doing all these calculations using a stored procedure. The problem is that we need data independence, and the stored procedure cannot provide this to us. But if I do all this all the time in .net based on the query base, I donβt think he can finish the job quickly.
For example, I need to query one table, which will return 2000 rows for me, and then for each row I need to query another table, which will return 300 results to me, than for each row of this, I need to query several tables (about 10) to get the required data , perform the calculation and save the output in another table.
Now my question is should I continue to solve the stored procedure and forget about the independence of the database, since performance is important. I also think that development time will be much shorter if we use the solution for stored procedures. If any of the clients wants this solution to be used in the oracle database (because they do not want to support another database), we transfer the stored procedures to the oracle database and support two versions for any future changes / improvements. Similarly, other clients may query other databases.
In the 2000 lines that I mentioned above, there is a skus product. The 300 lines that I mentioned have different attributes that we want to calculate, for example. transportation cost, transportation costs, etc. In the ten tables that I mentioned, there is information on currency conversion, unit conversion, network, region, company, sale price, daily quantity sold, etc. The resulting table stores all the information in the form of a star chart for analysis and reporting. The goal is to get any minute information about the product, so that you know what attribute of the sale of the product costs us money, and where we can make an improvement.