moneyslow.com

Discuz表机构性能优化标签表pre_common_tagitem

Discuz3的表结构

Discuz3的表结构

show processlist 的时候出现很多

SELECT itemid FROM pre_common_tagitem WHERE tagid IN ('123456','23423') AND idtype='tid' LIMIT 20;
SELECT itemid FROM pre_common_tagitem WHERE tagid IN ('12345','2342','45645','234','234234') 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%.

Exit mobile version