Viewing 11 posts - 1 through 11 (of 11 total)
My sample query I am using to test (for the attached query plan) takes around 30 seconds but it is based on a date range selection which has a date...
January 4, 2016 at 4:05 pm
Is there any way to do this and keep it as an inline function? Also, option(recompile) is already part of the query.
December 30, 2015 at 2:58 pm
My solution ended up being to create a stored procedure as a wrapper where I declare the empty table parameters and run the TVF. I then added the parameters to...
October 15, 2015 at 9:09 pm
So it seems this is definitely an issue of parameter sniffing.
While option(recompile) did nothing, option(optimize for unknown) brought the dynamic query down to 3 seconds. Still slower, but I can...
June 16, 2015 at 12:10 pm
Lynn Pettis (6/15/2015)
Maybe this:I still think the subquery function needs to be rewritten and perhaps some indexing to support it.
Gave this a try, but really didn't change anything. It seems...
June 16, 2015 at 8:26 am
Lynn Pettis (6/15/2015)
No promises, but here is one possible rewrite:
Thanks for taking the time to do this, but for some reason it actually worsened performance when I ran it using...
June 15, 2015 at 4:09 pm
Thanks Lynn. I updated the post to reflect the correct name of that table. You caught my refactoring error.
Some of the tables that this query is dealing with are...
June 15, 2015 at 11:21 am
Lynn Pettis (6/15/2015)
You are going to have do some work here as well:FROM dbo.SubQuery(DATEADD(day, num - 1, @First), @DatedStart, @DatedEnd, @Number, @Year, @Sub)
I thought maybe there was something I missed...
June 15, 2015 at 10:24 am
Here are the execution plans with the where clause replaced by top
Still no luck getting this thing to execute in the same time as non-parameterized even though now they both...
June 15, 2015 at 9:59 am
Alan.B (6/12/2015)
As a matter of practice, when using a cte tally table like you are, you may want to replace your WHERE clause with a TOP...
June 15, 2015 at 8:50 am
@jeff, there is no begin in the function. It is an inline function that does a cross apply with another inline function onto a range of dates
June 12, 2015 at 2:52 pm
Viewing 11 posts - 1 through 11 (of 11 total)