Is it faster to compute values in a query, call a Scalar Function (decimal(28,2) datatype) 4 times,

Posted by Pulsehead on Stack Overflow See other posts from Stack Overflow or by Pulsehead
Published on 2010-05-21T18:48:48Z Indexed on 2010/05/21 18:50 UTC
Read the original article Hit count: 128

I have a handful of queries I need to write in SQL Server 2005. Each Query will be calculating 4 unit cost values based on a handful of (up to 11) fields. Any time I want 1 of these 4 unit cost values, I'll want all 4. Which is quicker? Computing in the SQL Query ((a+b+c+d+e+f+g+h+i)/(j+k)), calling ComputeScalarUnitCost(datapoint.ID) 4 times, or joining to ComputeUnitCostTable(datapoint.ID) one time?

© Stack Overflow or respective owner

Related posts about optimization

Related posts about sql-server-2005