January 21, 2017 at 2:27 am
I have stored procedure which takes more than a min to run in sql browser.when i call from java UI it times out.It has group by and order by clause.Should the group by have same number of columns as order by?? to fix.
January 21, 2017 at 2:47 am
savibp3 - Saturday, January 21, 2017 2:27 AMI have stored procedure which takes more than a min to run in sql browser.when i call from java UI it times out.It has group by and order by clause.Should the group by have same number of columns as order by?? to fix.
You will have to share much more detailed information on the procedure, the data set, indices, preferably the actual execution plan(s) etc.
😎
Further,
January 21, 2017 at 3:14 am
Eirikur Eiriksson - Saturday, January 21, 2017 2:47 AMsavibp3 - Saturday, January 21, 2017 2:27 AMI have stored procedure which takes more than a min to run in sql browser.when i call from java UI it times out.It has group by and order by clause.Should the group by have same number of columns as order by?? to fix.You will have to share much more detailed information on the procedure, the data set, indices, preferably the actual execution plan(s) etc.
😎Further,
- Are the same parameter values passed in those instances?
- Are the calls made from the same system?
- Are the calling systems on the same network?
- Are the result sets identical?
I have temp table created in the procedure and variables declared.Data is passed to variables from output of other procedure.These variable are used in case statements within select statement.Select statement has lost of joins and group clause which in turn has multiple case statements and order by clause.the select statement is used to insert data into temp table. and later we are updating the temp table.
summary of data is the result set.
January 27, 2017 at 7:29 am
The only way to know the answer to your question is to take a look at the execution plan in order to understand the choices being made by the optimizer. If you post the plan here, we can help out. Otherwise, all I can do is suggest common code smells to avoid. Don't have functions on columns used in WHERE, ON or HAVING clauses. Be sure your statistics are up to date. Stuff like that.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
January 27, 2017 at 7:58 am
If you want help on performance, please read and heed the article at the second link under "Helpful Links" in my signature line below.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply