If performance of Scalar valued function or any user defined function is slower than SP’s
Why we need to go through User defined function rather to go with simple SP’s?
If performance of Scalar valued function or any user defined function is slower than
Share
UDF could introduce serious performance problems when it used in JOIN or WHERE clause and query returns big amount of data
so for each selected row UDF will be called and problem is in invocation latency introduced by UDF call. it simply can be tested by extracting UDF body inline of SP or query, difference will be easily observed.
But if query returns small amount of data it makes sense to separate logic into UDF so code of the main query/SP will be more clear.