| Author |
Topic |
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 12:13:20
|
| HIHiWe have scenario like this…please tell me your valuable suggestions.We have 300000 lacks records in a table. Functionality is, we have to take each by each record and apply the formula and stored it in a separate table. Which means it’s like looping operations.Bcoz the business scenario is like these…please tell me how to optimize. Please help out any optimized architecture for the same …Thankswoodhouse |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-23 : 12:29:15
|
| whats the formula you want to apply? what field is used to link b/w tables? or are you trying to dump entire data onto other table? |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 13:06:38
|
| HiThe scenario is like this...we have 25,000 items. So each item having 12 months dataIts total 3 lacks records.For this we need take each item. Based on the item we need to pull 12 months data and apply some inventory optimization formula’s (Its Generic Formula LFT, Minmax, POR, EOQ its all are related to inventory)So its taking too time to execution.. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-23 : 13:09:08
|
| are you using cursor or set based soln? |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 13:13:31
|
| HiI have done using WHILE loop |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-23 : 13:16:37
|
| no need of loop.. just use set based insert/update |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 13:18:46
|
| HiThats fine but i want to fetch each item of 25,000Based on the item i need to pull 12 months data |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-23 : 13:25:43
|
| you can use set based solution also. can you post sample data in below format?http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 13:48:25
|
HISimpleI have two tables one is master table & data tableMaster TablePart_ID PART_NAME COL3 COL4 etc....100 AAA X X ....Data table ID Part_ID Demand_data 1 100 122 100 133 100 144 100 155 100 166 100 177 100 188 100 199 100 2010 100 2111 100 22 12 100 23 The tables are like above...What i have done using loop i will fetch one by one Part_IDBeased on the part_id to pull out the 12 months data in Data tableFor above two scnario i have used WHILE loopso Total 25,000 records in master table 3 lacs records in dta table. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-23 : 13:51:55
|
you dont need while loop. all that you need isSELECT m.Part_ID,m.Part_Name,d.*FROM Master mINNER JOIN Data dON d.Part_ID=m.Part_ID to get 12 months data for each part |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 13:57:03
|
| hifine i agree i think no need to pu join bcoz i already having the part_id in data table so i can use directly ...but my issue is i need to apply 10 model calculation ffor each 12 months data |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-23 : 14:06:01
|
| same as how i showed you, you can apply formula also in set based way |
 |
|
|
WoodHouse
Posting Yak Master
211 Posts |
Posted - 2009-10-23 : 21:18:38
|
| Hican you pls explain or put some example here it would be helpful for me |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-24 : 04:45:50
|
| i can give you solution based on your scenario provided you post some sample data to illustrate your scenario and some info on functions you want to perform on them. also are you using sql 2005? |
 |
|
|
|