|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 3:35 PM
Points: 73,
Visits: 445
|
|
Hi everyone,
In the following scenarios, does anybody know if there is a difference in performance? The first uses a SCALAR FUNCTION, while the second uses a TABLE FUNCTION.
SELECT t1.Code, t1.Description, fn_ScalarFunction1(t1.Code) as xyz FROM Table1 t1 WHERE ….
SELECT t1.Code, t1.Description, f1.xyz FROM Table1 t1 OUTER APPLY fn_TableFunction1(t1.Code) as f1 WHERE ….
I was wondering if we can say that one is always better than the other, or if it depends on something else.
Thanks a lot, Luiz.
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 1:10 PM
Points: 646,
Visits: 729
|
|
Check this good discussion here: http://www.sqlservercentral.com/Forums/Topic446308-360-1.aspx
Maninder www.dbanation.com
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: 2 days ago @ 1:55 PM
Points: 15,442,
Visits: 9,571
|
|
It depends on what you are trying to do in the function.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, February 15, 2013 6:29 PM
Points: 1,326,
Visits: 1,265
|
|
Hi, Compare the execution plan. You will see the which provide the best performance for your case.
Regards.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 3:35 PM
Points: 73,
Visits: 445
|
|
Thank you for your answers.
As pointed, http://www.sqlservercentral.com/Forums/Topic446308-360-1.aspx covers this issue. I'll add my new questions to it.
Luiz.
|
|
|
|