From: Zhangzhigang Date: May 7 2012 8:53am Subject: =?utf-8?B?5Zue5aSN77yaIFdoeSBpcyBjcmVhdGluZyBpbmRleGVzIGZhc3RlciBhZnRl?= =?utf-8?B?ciBpbnNlcnRpbmcgbWFzc2l2ZSBkYXRhIHJvd3M/?= List-Archive: http://lists.mysql.com/mysql/227335 Message-Id: <1336380797.18758.YahooMailNeo@web15208.mail.cnb.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="104030145-451540920-1336380797=:18758" --104030145-451540920-1336380797=:18758 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable johan ....=0A>Plain and simple: the indices get updated after every insert = statement, =0Awhereas if you only create the index *after* the inserts, the= index gets created in a single operation, which is a lot more efficient..= =0A=0A=0AOk, Creating the index *after* the inserts, the index gets created= in a single operation.=0ABut the indexes has to be updating row by row aft= er the data rows has all been inserted. Does it work in this way?=0ASo i ca= n not find the different overhead=C2=A0 about two ways.=0A=0A=0A=0A=0A=0A__= ______________________________=0A =E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=9A Joha= n De Meersman =0A=E6=94=B6=E4=BB=B6=E4=BA=BA=EF=BC=9A Z= hangzhigang =0A=E6=8A=84=E9=80=81=EF=BC=9A mysql= @lists.mysql.com =0A=E5=8F=91=E9=80=81=E6=97=A5=E6=9C=9F=EF=BC=9A 2012=E5= =B9=B45=E6=9C=887=E6=97=A5, =E6=98=9F=E6=9C=9F=E4=B8=80, =E4=B8=8B=E5=8D=88= 4:28=0A=E4=B8=BB=E9=A2=98: Re: Why is creating indexes faster after insert= ing massive data rows?=0A =0A----- Original Message -----=0A> From: "Zhangz= higang" =0A> =0A> Creating indexes after insertin= g massive data rows is faster than=0A> before inserting data rows.=0A> Plea= se tell me why.=0A=0APlain 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 efficien= t.=0A=0AI seem to recall that inside of a transaction (thus, InnoDB or so) = the difference is markedly less; I might be wrong, though.=0A=0A=0A-- =0ABi= er met grenadyn=0AIs als mosterd by den wyn=0ASy die't drinkt, is eene kwez= el=0AHy die't drinkt, is ras een ezel --104030145-451540920-1336380797=:18758--