Views as a substitue for a UDF? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Views as a substitue for a UDF?

Question for everyone: We have a UDF which returns a table. In the past we were doing join’s in our procs directly with the UDF and noticed some performance hits. Then we started inserting the results from the UDF into a temptable and doing the join with that. I’m still not confident it’s working any better. How about creating a view which will give us the table that the UDF was returning, and then doing a join with the view – thereby eliminating the UDF altogether? What is considered best practices for these types of operations? Code readablity is nice, but of course performance is concern #1. Thanks!! ~w
Have you checked thru books online for such information between UDFs & Views. _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

AFAIK a UDF is not a true set based approach, but rather some kind of row by row processing.
If you have the opportunity to use a view (or a temp table), I would almost always use this. Especially when you have to deal with large resultsets. Frank
http://www.insidesql.de
http://www.familienzirkus.de
]]>