show processlist 的时候出现很多
SELECT itemid FROM pre_common_tagitem WHERE tagid IN ('037790','60154') AND idtype='tid' LIMIT 20;
SELECT itemid FROM pre_common_tagitem WHERE tagid IN ('05369','5458','5507','16540','52798') AND idtype='tid' LIMIT 20;
类似这样的sql语句。修改 pre_common_tagitem 表结构,就可以优化性能。
修改表的sql语句为
ALTER TABLE pre_common_tagitem CHANGE tagid tagid smallint(6) unsigned NOT NULL default '0';
ALTER TABLE pre_common_tagitem CHANGE itemid itemid mediumint(8) unsigned NOT NULL default '0';
修改前,mysqld 占用cpu超过100%, 优化后,mysqld占用cpu不超过10%.
SELECT itemid FROM pre_common_tagitem WHERE tagid IN ('037790','60154') AND idtype='tid' LIMIT 20;
SELECT itemid FROM pre_common_tagitem WHERE tagid IN ('05369','5458','5507','16540','52798') AND idtype='tid' LIMIT 20;
类似这样的sql语句。修改 pre_common_tagitem 表结构,就可以优化性能。
修改表的sql语句为
ALTER TABLE pre_common_tagitem CHANGE tagid tagid smallint(6) unsigned NOT NULL default '0';
ALTER TABLE pre_common_tagitem CHANGE itemid itemid mediumint(8) unsigned NOT NULL default '0';
修改前,mysqld 占用cpu超过100%, 优化后,mysqld占用cpu不超过10%.
编辑回复