Search code examples
sqlinsertmysqldump

Difference between inserto into in each line or just one per table


I use two forms of backup on my clients table. Sometimes I use the mysqldump and sometimes I use the SQLYog backup.

SQLYog creates the insert this way:

insert  into `tbb111`(`PPU_NOME_USU`,`PPU_NOME_PRG`,`PPU_SEQ_PRG`,`PPU_DES_PPU`) values ('RACHEL','SDMW','0','Todas     ;01012014;28022014;00001;;;');
insert  into `tbb111`(`PPU_NOME_USU`,`PPU_NOME_PRG`,`PPU_SEQ_PRG`,`PPU_DES_PPU`) values ('RACHEL','SDMW2251','0','01012013;31122014;');
insert  into `tbb111`(`PPU_NOME_USU`,`PPU_NOME_PRG`,`PPU_SEQ_PRG`,`PPU_DES_PPU`) values ('RACHEL','SDMW2290','0','Todos;01012013;31122014;;;;00000000000;99999999999;;');

And the mysqldump creates this way:

INSERT INTO `sdm638` VALUES 
('1','1','201402','1002','Computadores e Periféricos','0','0','222222','0','733.4800','539.3200','1272.8000','0.0000','0.0000','0.0000','0.0000','0','0','0'), 
('1','1','201402','1008','Veículos','0','0','222222','0','0.0000','42900.0000','42900.0000','0.0000','0.0000','0.0000','0.0000','0','0','0'),
('1','1','201402','2001','Água e Esgoto','0','0','222222','0','458.6400','458.6400','917.2800','0.0000','0.0000','0.0000','0.0000','0','0','0'),
('1','1','201402','2002','Combustível','0','0','222222','0','0.0000','237.6000','237.6000','0.0000','0.0000','0.0000','0.0000','0','0','0'),
('1','1','201402','2004','Copa e Cozinha','0','0','222222','0','463.2000','181.6998','644.8998','0.0000','0.0000','0.0000','0.0000','0','0','0')

Mysqldump is obviously better since the file is a lot smaller. I just tested on a client the mysqldump got 2.5gb while the SQLYog is 8gb.

I want to know whats the difference between them.The mysqldump will always work even without the insert into in every line? Performance is the same or the mysqldump is faster since have less code?

Thanks guys.


Solution

  • Functionally both are the same, but from the performance point of view the latter (mysqldump version) is much faster since parsing is not performed to every row but rather to a bunch of rows at once.

    Recommended reading: