I have this simple query:
INSERT IGNORE INTO beststat (bestid,period,rawView) VALUES ( 4510724 , 201205 , 1 ) On the table:
CREATE TABLE `beststat` ( `bestid` int(11) unsigned NOT NULL, `period` mediumint(8) unsigned NOT NULL, `view` mediumint(8) unsigned NOT NULL DEFAULT '0', `rawView` mediumint(8) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`bestid`,`period`), ) ENGINE=InnoDB AUTO_INCREMENT=2020577 DEFAULT CHARSET=utf8 And it takes 1 sec to completes.
Side Note: actually it doesn't take always 1sec. Sometime it's done even in 0.05 sec. But often it takes 1 sec
This table (beststat) currently has ~500'000 records and its size is: 40MB. I have 4GB RAM and innodb buffer pool size = 104,857,600, with: Mysql: 5.1.49-3
This is the only InnoDB table in my database (others are MyISAM)
ANALYZE TABLE beststat shows: OK
Maybe there is something wrong with InnoDB settings?
REPLACE INTO beststat (bestid,period,rawView) VALUES (x,y,z)for collidong values of x,y andINSERT INTO beststat (bestid,period,rawView) VALUES (x,y,z)for non-colliding values of x,y- obviously makeing sure you don't destroy anything valueable - and post result for comparison