sphinx9999 Posted October 10, 2008 Share Posted October 10, 2008 I have a large amount of data (20m+ rows) in tableA with no indexes. I am copying this to tableB which has an index on a date field. I am copying it using INSERT INTO tableB SELECT * FROM tableA type syntax. Will mysql update the index once for each row in tableA (boooo) or once at the end of the query (yaaay)? If the former is true then I guess I can delete the index before starting and then recreate it at the end. Thanx Quote Link to comment https://forums.phpfreaks.com/topic/127845-solved-when-are-indexes-updated/ Share on other sites More sharing options...
fenway Posted October 11, 2008 Share Posted October 11, 2008 It will do it on each row unless you use LOAD DATA... but you can DISABLE KEYS and/or LOCK the tables, too. Quote Link to comment https://forums.phpfreaks.com/topic/127845-solved-when-are-indexes-updated/#findComment-662884 Share on other sites More sharing options...
sphinx9999 Posted October 12, 2008 Author Share Posted October 12, 2008 you can DISABLE KEYS and/or LOCK the tables Ah yes, I recon DISABLE KEYS is the way to go, thanks. Incidently, how will locking the tables help? Does this also stop the index update? Quote Link to comment https://forums.phpfreaks.com/topic/127845-solved-when-are-indexes-updated/#findComment-663332 Share on other sites More sharing options...
fenway Posted October 13, 2008 Share Posted October 13, 2008 Yes, I believe that it does... there would be no reason to update the indexes until you were "done". Quote Link to comment https://forums.phpfreaks.com/topic/127845-solved-when-are-indexes-updated/#findComment-664230 Share on other sites More sharing options...
sphinx9999 Posted October 13, 2008 Author Share Posted October 13, 2008 Cool, thanx fenway Quote Link to comment https://forums.phpfreaks.com/topic/127845-solved-when-are-indexes-updated/#findComment-664399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.