May 30, 2013 at 9:59 am
I have a Stored Proc that calls a Scalar Valued function...
When I run the Scalar Valued function
select dbo.f_ScalarFunction (@Param1, @Param2, @Param3) and check Inlude Actual execution plan..
I see that it does a CONSTANT SCAN ... ??
I see my underlying Queries in the function are well optimized...they do Index Seek if run in isolation.
Question is Does Scalar Valued function not utilize the Query plan of the underlying SQL Queries ?
Do they always do CONSTANT SCAN ?
May 30, 2013 at 10:06 am
WangcChiKaBastar (5/30/2013)
I have a Stored Proc that calls a Scalar Valued function...When I run the Scalar Valued function
select dbo.f_ScalarFunction (@Param1, @Param2, @Param3) and check Inlude Actual execution plan..
I see that it does a CONSTANT SCAN ... ??
I see my underlying Queries in the function are well optimized...they do Index Seek if run in isolation.
Question is Does Scalar Valued function not utilize the Query plan of the underlying SQL Queries ?
Do they always do CONSTANT SCAN ?
Constant Scan provides your query with in-memory table of constant values. I don't think you should worry about it. It has nothing to do with Table/Index scan.
May 30, 2013 at 10:11 am
It may help to know what the function does and how it is used, can you post some code?
May 30, 2013 at 10:38 am
As general information, user defined scalar valued functions won't allow you to use parallellism in your queries.
You might find better performance using an inline Scalar Valued Function as called by Jeff Moden on this article: http://www.sqlservercentral.com/articles/T-SQL/91724/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply