SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


help with stored procedure tuning.


help with stored procedure tuning.

Author
Message
Lucky9
Lucky9
SSC-Enthusiastic
SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)SSC-Enthusiastic (132 reputation)

Group: General Forum Members
Points: 132 Visits: 297
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...
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40248 Visits: 38567
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.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Luis Cazares
Luis Cazares
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16850 Visits: 19122
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.


Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
GilaMonster
GilaMonster
SSC Guru
SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)

Group: General Forum Members
Points: 89079 Visits: 45284
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

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Sean Pearce
Sean Pearce
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1802 Visits: 3432
Lucky9 (6/13/2013)
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...

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.



The SQL Guy @ blogspot

@SeanPearceSQL

About Me
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search