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
- Drop Indexes
- Insert Rows
- Recreate Indexes
that might improve the performance.
Also - are you sure you reading from PartyMain and Inserting into PartyMain?
精彩评论