Chandu M
asked on
Performance issue in stored procedure in SQL Server 2012
I am new to SQL server, I have a Stored procedure that returning only almost 1733 rows but taking long time to execute.Please find the stored procedure below and help me to get increase the performance I am using MS SQL Server 2012 I am unable to attache test result and execution plan
TEST_SP.txt
TEST_SP.txt
ASKER
Hi Vitor,
Thanks for your comments,
I have executed the by the replacing you changed block and i got the below error
Msg 8120, Level 16, State 1, Procedure ADMIN_TEST_SP, Line 114
Column '#USERID.DISPLAYUSERID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Msg 8120, Level 16, State 1, Procedure ADMIN_TEST_SP, Line 192
Column '#USERID.DISPLAYUSERID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Please find attachment for execution plan
execution_plan.sqlplan
Thanks for your comments,
I have executed the by the replacing you changed block and i got the below error
Msg 8120, Level 16, State 1, Procedure ADMIN_TEST_SP, Line 114
Column '#USERID.DISPLAYUSERID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Msg 8120, Level 16, State 1, Procedure ADMIN_TEST_SP, Line 192
Column '#USERID.DISPLAYUSERID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Please find attachment for execution plan
execution_plan.sqlplan
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Vitor,
Thanks for your update.
SP was compiled and SP got executed the given the result in 1 min and 17 sec for 1733 records .This duration is same as previous and no much betterment in performance.Could you please help me to get for some more better performance.
And thank you so much for your prompt response.Please look into execution plan if possible
Thanks in advance
Thanks for your update.
SP was compiled and SP got executed the given the result in 1 min and 17 sec for 1733 records .This duration is same as previous and no much betterment in performance.Could you please help me to get for some more better performance.
And thank you so much for your prompt response.Please look into execution plan if possible
Thanks in advance
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Chandu, a feedback will be appreciated.
Cheers
Cheers
Recommendation to close this question by accepting the above comments as answer.
At the first sight I can see issues with subselects so I've transformed them in INNER JOIN. Check if with the following change the SP will run faster (only the changed block):
Open in new window