Home > database >  Why is slower than the Innodb consult MyIsam insert
Why is slower than the Innodb consult MyIsam insert

Time:09-26

On nuclear 1 g of this kind of cloud server installed a MSYQL YUM way
Test insert 10000 data, why is slower than the Innodb MyIsam insert, MyIsam with 10 s, Innodb use 1 s,
Insert the script is as follows:
 
The BEGIN
Set the session the autocommit=0;
Truncate table t1;
The set @ starttime=unix_timestamp (current_timestamp ());
The set @ I=0;
The set @ num=10000;
While @ i<@ num do
Insert into t1 values (id1, id2, content) (@ I, @ I, "aaa");
The set @ I=@ I + 1;
End the while;
commit;
The set @ endime=unix_timestamp (current_timestamp ());
Select @ endime - @ starttime;
END



Table id1, id2, three fields, the content of two int, a varchar, it is very strange

CodePudding user response:

Is it because of compression

CodePudding user response:

MyIsam is suitable for the scene, to read more writing less generally use InnoDB

CodePudding user response:

MyISM data structure, and the Innodb data interface, the structure is different also,

CodePudding user response:

Find the problem, can turn off the binlog, MyIsam binlog writing is much bigger than the Innodb

CodePudding user response:

Well, well,
Innodb support transaction myisam doesn't support the
5.7 after the default data engine is innodb,

To choose according to your actual scene,
Why do you use scenario need myisam?

CodePudding user response:

reference 5 floor kingmax54212008 reply:
well, well,
Innodb support transaction myisam doesn't support the
5.7 after the default data engine is innodb,

To choose according to your actual scene,
Why do you use scenario need myisam?


We are OLAP scenario, but 8.0 is suggested using innodb instead of myisam, myisam very few alternatives can be optimized

CodePudding user response:

Yes,
Innodb for OLTP scenarios,

CodePudding user response:

His experience
1. Choose MySQL mindless use InnoDB,
2. A large number of insert with bulk insert, MySQL is behind the values with multiple records,

CodePudding user response:

Have a rewriteBatchedStatements parameters, can be in the url configuration, realize the bulk insert, improve obviously the performance of the innodb,
  • Related