开发者

InnoDB strange performances

I'm doing some tests with a really simple InnoDB table (named Test) with the following structure:

Id int(10) unsigned NOT NULL AUTO_INCREMENT
UserId int(10) NOT NULL
Body varchar(512) COLLATE utf8_unicode_ci NOT NULL
CreatedAt datetime NOT NULL

one additional index on UserId:

KEY Idx_Test_UserId (UserId) USING BTREE

When I try to execute this query...

INSERT INTO Comments (UserId,Body,CreatedAt) VALUES (1,'This is a test',NOW());

...sometimes I get the operation completed in a few milliseconds but开发者_开发知识库 some other times it takes around a second.

I'm the only one person doing the tests on this specific table, I really don't understand I have such execution time differences.

Last note, when I'm doing the same tests with a MyISAM table I don't have any issues.


InnoDB works by default in AUTOCOMMIT mode, which means that every insert requires two seperate write to disk operations. If you have only one disk drive in your machine, sometimes you might need to wait a bit fr that. Also, AFAIR InnoDB used to have (not sure if it's still the case) a bit of performance problemws with writing to disk in Windows, but I think it involved concurrency higher than 1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜