c# - Perform Data Analysis on Sql Server or in .Net? -


I have some data analysis that needs to be performed. On average, somewhere in between this would be somewhere between 50K-150K rows. From these lines, I need to remove the sum of the calculus (x) along with the sum (x) plus five different criteria. There are two ways to go about this:

  1. Write 10 different questions, designed to collect data from column X using each of the equals () or calculations () has gone. Run each and get results using SqlCommand.ExecuteScalar ().
  2. Create a custom object to include all the different criteria, which is necessary to evaluate different situations. Run a query that will return all the data needed to create a superset of all different conditional subsets using SQL Commands.execcadata reader (). Read each line from the DataReader in a new object, adding each list to the list store. All data is retrieved, use Linq-to-Object to define different amount () and calculation values ​​() based on different conditions.

I know that I can try every one to see what is the fastest, but I am interested in the advice of the community on which one can swiftly assume Take that the SQL server and the web server are running on each machine, enough memory with each

Right now I am leaning towards Option 1. However, there are many more questions for DB, DB itself will do aggregation and very few data on SQL server and web server. With Option 2, there is only one query, but it will send a very large amount of data to the net. Net, and then. Net will have to bear all heavy load in relation to overall tasks (and though I do not have anything on the basis of it, I suspect that the SQL server is more efficient in running such a large number of tasks).

Any idea to go the way (or a third option which I am missing)?

The database is usually the best option for analyzing data like this, and I # Had to go for 1.

However, I also consider the third option, in which you make a single query, which you do with SQL (in place of ten). It may involve involving a case statement in total tasks, so that you can do all the work at the same passage of data.

Think of the old way of pivoting:

  SELECT SUM (case when condition X = 1 then some filed END) as SUM1 SUM (case when condition X = 2 Then some field-end) Sour2 with Sourdata;  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -