insert

Last Post 07 Aug 2009 07:18 AM by sql-tips. 3 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
sql-tips
New Member
New Member

--
03 Aug 2009 09:55 AM
I have bunch of following insert statements, each one takes 15 to 20 mins. I want to tune these queries, can anyone explain me all areas I should look into. I already rebuild the indexes, ran the defragmentation etc..

insert into table a
select * from table b where c in(38388,8883883, etc.. like 2500 numbers)

insert into table temp
select * from table tempabc where ab in(73777,66633, like 3000 numbers)
sql-tips
New Member
New Member

--
03 Aug 2009 10:19 AM
Thanks for info. This might be a code change insert into temp table, anyways I will suggest the client. However, what else we can do on database side with minimal code change.
sql-tips
New Member
New Member

--
05 Aug 2009 10:15 AM
in question to another tuning query. I have following update statement and takes 2 hours to complete even though there are 10000 records.

update a
set col1= 1000
from table1,table2
where table1.colA = table2.ColA
and table1.col1 = 10
and table2.colB = 'USD'

I am not sure what to tune this query.
sql-tips
New Member
New Member

--
07 Aug 2009 07:18 AM
thanks guys for your help. I got a solution. I see update trigger on the table, whenever there is a update another process is kicking off and because of this as you said it is blocking. I put it in the loop and took chunks of records at a time and it worked in a minute.


Acceptable Use Policy
---