Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

help with stored procedure tuning. Expand / Collapse
Author
Message
Posted Thursday, June 13, 2013 1:22 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Sunday, February 16, 2014 9:35 PM
Points: 98, 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...
Post #1463278
Posted Thursday, June 13, 2013 1:31 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 9:44 AM
Points: 20,705, Visits: 32,357
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.



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)
Post #1463282
Posted Thursday, June 13, 2013 1:32 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 10:49 AM
Points: 3,644, Visits: 8,159
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.
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?

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1463283
Posted Thursday, June 13, 2013 3:11 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:59 AM
Points: 39,984, Visits: 36,353
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 2008, MVP
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

Post #1463325
Posted Friday, June 14, 2013 7:09 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 8:12 AM
Points: 917, Visits: 2,886
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
Post #1463547
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse