Click here to Skip to main content
14,423,036 members
Rate this:
Please Sign up or sign in to vote.
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 21:19pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

Go through the following-

sql-server-stored-procedure-optimization
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100