From: Johan De Meersman Date: May 7 2012 8:28am Subject: Re: Why is creating indexes faster after inserting massive data rows? List-Archive: http://lists.mysql.com/mysql/227334 Message-Id: <7deeb001-bd9a-45e0-b847-c203df2f86a2@zimbra> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit ----- Original Message ----- > From: "Zhangzhigang" > > Creating indexes after inserting massive data rows is faster than > before inserting data rows. > Please tell me why. Plain and simple: the indices get updated after every insert statement, whereas if you only create the index *after* the inserts, the index gets created in a single operation, which is a lot more efficient. I seem to recall that inside of a transaction (thus, InnoDB or so) the difference is markedly less; I might be wrong, though. -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel