October 17, 2010 at 10:25 pm
How to make use of UDF or subquery?
Which is better one with performance considerations?
thanks
🙂
October 17, 2010 at 11:07 pm
SQL* (10/17/2010)
How to make use of UDF or subquery?Which is better one with performance considerations?
thanks
"It Depends". You have to test each way based on the situation you're trying to solve. Also keep in mind all of the choices you have...
Scalar Function
Multiline Table Valued Function (mlTVF)
Inline Table Valued Function (iTVF)
CROSS APPLY
Correlated Subquery
Subquery
Join
Most people will tell you to avoid the Scalar and mlTVF types of functions. They'll also tell you to avoid the Correlated Subquery. I'll tell you, "It Depends". I've seen where iTVF's can create quite the performance problem and where they can be miracles of performance, for example.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 17, 2010 at 11:08 pm
Test both and see which performs better?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply