June 13, 2013 at 1:22 pm
trying to fine tune a stored procedure
it has 10 union all between select scripts..performance is very slow...what is the alternate for union all..
and all the select statements have derived tables...so performance is very slow and sometimes we get the time out error also...
and in where clause we have left and max also...i think those are the 2 functions that are making the performance slow as well ...so what would be the alternate for left function..
i cannot paste any sql and explain plans...but if somebody can tell me the alternates for union all and left functions..that would be really great...
June 13, 2013 at 1:31 pm
Not sure if there is much we can do if you can't post anything. Last I checked my crystal ball was broken and still in the shop, and the force isn't that strong.
June 13, 2013 at 1:32 pm
Some divide and conquer strategy might help, meaning to use temp tables or staging tables instead of massive union alls.
Without more details is hard to give an advise. Maybe you could share the code changing the table and column names, same thing with the execution plan.
June 13, 2013 at 3:11 pm
Union all usually one of the most efficient ways of concatenating result sets. The alternative to LEFT functions is usually to not use the function at all.
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
June 14, 2013 at 7:09 am
Lucky9 (6/13/2013)
trying to fine tune a stored procedureit has 10 union all between select scripts..performance is very slow...what is the alternate for union all..
and all the select statements have derived tables...so performance is very slow and sometimes we get the time out error also...
and in where clause we have left and max also...i think those are the 2 functions that are making the performance slow as well ...so what would be the alternate for left function..
i cannot paste any sql and explain plans...but if somebody can tell me the alternates for union all and left functions..that would be really great...
UNION ALL simply concatenates result sets so I doubt that is the cause of your poor performance. It will be impossible to provide a solution when you have not provided anything to work with, but I can suggest to tackle each select statement separately.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply