我使用大型随机数作为密钥(从另一个系统进入).在相当小的(如几百万行)表中插入和更新所花费的时间比我认为合理的要长得多.
我已经提炼了一个非常简单的测试来说明.在测试表中,我试图让它变得尽可能简单; 我的真实代码没有这么简单的布局,并且有关系和附加索引等.但是,更简单的设置显示了相同的性能.
结果如下:
creating the MyISAM table took 0.000 seconds
creating 1024000 rows of test data took 1.243 seconds
inserting the test data took 6.335 seconds
selecting 1023742 rows of test data took 1.435 seconds
fetching 1023742 batches of test data took 0.037 seconds
dropping the table took 0.089 seconds
creating the InnoDB table took 0.276 seconds
creating 1024000 rows of test data took 1.165 seconds
inserting the test data took 3433.268 seconds
selecting 1023748 rows of test data …Run Code Online (Sandbox Code Playgroud)