I am building a SSIS package to pull in and aggregate job cost data from our SQL Server OLTP system to our data warehouse. I have built a view on the OLTP server that will pull JobNumber, MtlQty, and MtlCost for each material item associated with the job. In the data warehouse, I just want to store total material cost for each job. As I see it, I have two options:
1.Tweak the view to provide:
-OR-
2. Add a Derived Column transform in my SSIS package to perform the (MtlQty * MtlCost) calculation for each row, then use an Aggregate transform to sum them by job.
Will one method typically be faster than the other, or is it hit and miss depending on the usual variables (server memory, server CPU configuration, etc.)?
1.Tweak the view to provide:
Code:
SELECT
JobNum,
IsNull(Sum(MtlQty * MtlCost),0) as TotalCost
-OR-
2. Add a Derived Column transform in my SSIS package to perform the (MtlQty * MtlCost) calculation for each row, then use an Aggregate transform to sum them by job.
Will one method typically be faster than the other, or is it hit and miss depending on the usual variables (server memory, server CPU configuration, etc.)?