Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a table containing almost 10 lacks number of records like :-
ID________Data______Data1_____Batch1_______Batch2
1_________1000______AHDG________01___________01
2_________1001______KJFN________01___________01
3_________1002______LDET________02___________01
4_________1003______PLSI________02___________01
5_________1004______NCBD________03___________01
6_________1005______ZXIR________03___________01
7_________1006______PLAS________01___________02
8_________1007______VBTY________01___________02
9_________1008______PAZM________02___________02
10________1009______LKKL________02___________02
11________1010______VNBG________03___________02
12________1011______SKSJ________03___________02


I have created a stored procedure which gives output as follows :-
ID________Start______End_______Total___Batch1___Batch2
1_________1000______1001________2_______1________1
2_________1002______1003________2_______2________1
3_________1004______1005________2_______3________1
4_________1006______1007________2_______1________2
5_________1008______1009________2_______2________2
6_________1010______1011________2_______3________2


The problem is that, this stored procedure is taking too much time to group 10 Lacks records (1hr,2mins).
I have tried to index on several columns, but no effect.
Please Advice.
Posted
Updated 15-Jan-12 20:19pm
v2

1 solution

Go through the following-

sql-server-stored-procedure-optimization
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900