你好,這是我的表結構大MySQL表更新慢
CREATE TABLE IF NOT EXISTS `sms_report` (
`R_id` int(11) NOT NULL auto_increment,
`R_uid` int(11) NOT NULL,
`R_smppid` varchar(100) collate utf8_unicode_ci NOT NULL,
`R_from` varchar(10) collate utf8_unicode_ci NOT NULL,
`R_status` longtext collate utf8_unicode_ci NOT NULL,
`R_message` text collate utf8_unicode_ci NOT NULL,
`R_numbers` longtext collate utf8_unicode_ci NOT NULL,
`R_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`R_timedate` varchar(40) collate utf8_unicode_ci NOT NULL,
`R_show` int(11) NOT NULL default '1',
`oldformat` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`R_id`)
)ENGINE = MyISAM的默認字符集= UTF8 COLLATE = utf8_unicode_ci AUTO_INCREMENT = 1947722;
我有大約200萬行,所以當我在這裏對R_status進行更新時,它似乎需要很長時間(R_status是1,2,16或24)。 請建議如何優化。
您是僅基於WHERE子句中的R_id更新的嗎?或其他列?你可以發佈一個樣例'UPDATE'查詢嗎? – aularon 2010-09-03 08:39:57
示例更新查詢將爲 update sms_report set R_status = 1其中R_smppid = 738sbdasdbajsdbdfbfbks782 | 9898773122 – 2010-09-03 08:42:17