| Author |
Topic |
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-01-02 : 02:26:04
|
| Hi All,I am using SQLServer 2005.my SQLServer system ram is 2 GB.It is taking time to insert even 1 record .what to do ? thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-02 : 02:28:07
|
| what are indexes present in table?does it have insert triggers?are you doing insert inside transaction?is there any other transaction currently running which uses this table records? |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-01-02 : 02:39:14
|
quote: Originally posted by visakh16 what are indexes present in table?does it have insert triggers?are you doing insert inside transaction?is there any other transaction currently running which uses this table records?
Hi,I am executing 6 insert queries in a procedure.No trigers.I had one unique column for all tables, i create index for that column in all tables.thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-02 : 02:44:39
|
| are you trying to do it within separate transactions? can you show insert code? |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-01-02 : 02:51:27
|
quote: Originally posted by visakh16 are you trying to do it within separate transactions? can you show insert code?
Hi,No i am putting all the insert queries one after one in a while loopat the end of all queries i am comiting.for ex:while ... begin trans insert into tab1... insert into tab2... . . . transaction commit end trans |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-02 : 02:53:13
|
| is the begin tran outside while loop? |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-01-02 : 02:59:18
|
quote: Originally posted by visakh16 is the begin tran outside while loop?
No visakh, everyting is with in the while loop only |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-02 : 03:05:48
|
| whats the need of doing this within while loop? |
 |
|
|
asuni
Yak Posting Veteran
55 Posts |
Posted - 2010-01-02 : 03:22:35
|
quote: Originally posted by visakh16 whats the need of doing this within while loop?
While loop is for one simple select query.selecting one column data, in where condition col column is there.i created index for that where condition column. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-02 : 03:23:58
|
| sorry i cant understand why you cant do all this set based. what's need for doing record by record insert? |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2010-01-02 : 06:28:50
|
| Have you tried not using a loop statement and doing the INSERT statements as set based i.e create the values you require and place them in variables , and then pass the variables to the INSERT statements , e.gDECLARE @var1 INT ,@var2 VARCHAR(20)INSERT INTO myTable ..@var2INSERT INTO myTable2 ..@var1and see if this improves things , at minimum this will allow you to isolate if the loop statement is creating issues.Jack Vamvas--------------------http://www.ITjobfeed.com (IT jobs) |
 |
|
|
|