开发者

Inserting Millions of Rows from another table

Faster way to insert rows into a table from a select statement and insert into?

Insert into PartyMain
Select [PermID]
      ,[IsOptOut]
      ,[UpdatedOn]
开发者_Python百科      ,[FK_DataSource]
 From PartyMain

with 6M rows is taking > 4 minutes


insert via select is the fastest way i can think of to insert data. You might be able make improvements in you app work flow, however.

I imagine have some sort of button in an app that kicks off the process. Instead of doing the insert when a user tells the app to (Im making that assumption), can you have a process that runs every X seconds that does the transfer? Or alternatively check every X seconds and if the number of rows to transfer is greater than Y, run the transfer...So in other words, dont wait until there are 6 million rows.

Edit- another options might be database triggers.


Do you have any indexes on PartyMain? If yes, you may want to

  1. Drop Indexes
  2. Insert Rows
  3. Recreate Indexes

that might improve the performance.

Also - are you sure you reading from PartyMain and Inserting into PartyMain?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜