destoon v7 MYSQL占用大量CPU的优化

Posted on 2011-12-12 14:37  黔人阿诺  阅读(560)  评论(0编辑  收藏  举报

ALTER TABLE `destoon_sell_5` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_sell_5` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_sell_5` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_sell_5` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_sell_5` ADD INDEX ( `ip` ) ;


ALTER TABLE `destoon_mall` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_mall` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_mall` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_mall` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_mall` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_buy_6` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_buy_6` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_buy_6` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_buy_6` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_buy_6` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_quote` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_quote` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_quote` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_group` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_group` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_group` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_group` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_group` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_exhibit` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_exhibit` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_exhibit` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_news` ADD INDEX ( `status` ) ;

ALTER TABLE `destoon_info_22` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_info_22` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_info_22` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_info_22` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_info_22` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_brand_13` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_brand_13` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_brand_13` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_brand_13` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_brand_13` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_job` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_job` ADD INDEX ( `vip` ) ;
ALTER TABLE `destoon_job` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_job` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_know` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_know` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_know` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_photo_12` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_photo_12` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_photo_12` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_video_14` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_video_14` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_video_14` ADD INDEX ( `ip` ) ;


ALTER TABLE `destoon_down_15` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_down_15` ADD INDEX ( `thumb` ) ;
ALTER TABLE `destoon_down_15` ADD INDEX ( `ip` ) ;

ALTER TABLE `destoon_404` ADD INDEX ( `url` ) ;
ALTER TABLE `destoon_404` ADD INDEX ( `addtime` ) ;


ALTER TABLE `destoon_company` ADD INDEX ( `catid` ) ;
LTER TABLE `destoon_company` ADD INDEX (`catids`);  
ALTER TABLE `destoon_company` ADD FULLTEXT (`catids`);


ALTER TABLE `destoon_upload_0` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_0` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_1` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_1` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_2` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_2` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_3` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_3` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_4` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_4` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_5` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_5` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_6` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_6` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_7` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_7` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_upload_9` ADD INDEX ( `addtime` ) ;
ALTER TABLE `destoon_upload_9` ADD INDEX ( `username` ) ;

ALTER TABLE `destoon_category` ADD INDEX ( `parentid` ) ;
ALTER TABLE `destoon_category` ADD INDEX ( `listorder` )
ALTER TABLE `destoon_category` ADD INDEX ( `item` ) ;

ALTER TABLE `destoon_area` ADD INDEX ( `parentid` ) ;
ALTER TABLE `destoon_area` ADD INDEX ( `listorder` ) ;

ALTER TABLE `destoon_comment_stat` ADD INDEX ( `moduleid` ) ;
ALTER TABLE `destoon_comment_stat` ADD INDEX ( `itemid` ) ;

ALTER TABLE `destoon_message` ADD INDEX ( `ip` ) ;
ALTER TABLE `destoon_message` ADD INDEX ( `typeid` ) ;
ALTER TABLE `destoon_message` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_message` ADD INDEX ( `addtime` );

ALTER TABLE `destoon_message` ADD INDEX ( `isread` ) ;
ALTER TABLE `destoon_message` ADD INDEX ( `issend` );


ALTER TABLE `destoon_online` ADD INDEX ( `lasttime` ) ;

ALTER TABLE `destoon_guestbook` ADD INDEX ( `status` ) ;

ALTER TABLE `destoon_keyword` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_keyword` ADD INDEX ( `updatetime` ) ;
ALTER TABLE `destoon_keyword` ADD INDEX ( `month_search` ) ;
ALTER TABLE `destoon_keyword` ADD INDEX ( `total_search` ) ;
ALTER TABLE `destoon_keyword` ADD INDEX ( `week_search` ) ;
ALTER TABLE `destoon_keyword` ADD INDEX ( `today_search` ) ;

ALTER TABLE `destoon_alert` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_alert` ADD INDEX ( `addtime` ) ;

ALTER TABLE `destoon_webpage` ADD INDEX ( `item` ) ;
ALTER TABLE `destoon_webpage` ADD INDEX ( `listorder` ) ;

ALTER TABLE `destoon_announce` ADD INDEX ( `listorder` ) ;

ALTER TABLE `destoon_link` ADD INDEX ( `status` ) ;

ALTER TABLE `destoon_member` ADD INDEX ( `regtime` ) ;

ALTER TABLE `destoon_ad` ADD INDEX ( `status` ) ;
ALTER TABLE `destoon_ad` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_spread` ADD INDEX ( `username` ) ;
ALTER TABLE `destoon_spread` ADD INDEX ( `status` ) ;
#下面为全文索引 destoon_club_data 类似的模块内容全文最好都开启 其它的后台有提示

ALTER TABLE `destoon_club_data` ADD FULLTEXT (`content`);
ALTER TABLE `destoon_cron` ADD INDEX ( `nexttime` );
ALTER TABLE `destoon_online` ADD INDEX ( `username` );

#公司 供应 模块增加全文索引 建议用ngram版
ALTER TABLE `destoon_company` ADD FULLTEXT (`company`);
ALTER TABLE `destoon_company` ADD FULLTEXT (`business`);
ALTER TABLE `destoon_company_data` ADD FULLTEXT (`content`);
ALTER TABLE `destoon_sell_5` ADD FULLTEXT (`title`);
ALTER TABLE `destoon_sell_data_5` ADD FULLTEXT (`content`);

#用中文检索分词插件ngram版 MySQL 5.7.6以上版本 中文识别友好 要修改程序
ALTER TABLE `destoon_keyword` ADD FULLTEXT (`keyword`) WITH PARSER ngram;
ALTER TABLE `destoon_company` ADD FULLTEXT (`company`,`business`) WITH PARSER ngram;
ALTER TABLE `destoon_sell_5` ADD FULLTEXT (`title`,`introduce`)WITH PARSER ngram;