DESTOON MYSQL占用大量CPU的优化
以下是SQL语句(请对照自己的SQL表前缀,教程以默认前缀为例),执行前请先备份SQL
- 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_sell_5` ADD INDEX ( `hits` ) ;
- ALTER TABLE `destoon_sell_5` ADD INDEX ( `introduce` ) ;
- ALTER TABLE `destoon_sell_5` ADD INDEX ( `keyword` ) ;
- ALTER TABLE `destoon_sell_5` ADD INDEX ( `level` ) ;
- ALTER TABLE `destoon_sell_5` ADD INDEX ( `catid` ) ;
- ALTER TABLE `destoon_sell_5` ADD INDEX ( `username` ) ;
- 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_buy_6` ADD INDEX ( `hits` ) ;
- ALTER TABLE `destoon_buy_6` ADD INDEX ( `introduce` ) ;
- ALTER TABLE `destoon_buy_6` ADD INDEX ( `keyword` ) ;
- ALTER TABLE `destoon_buy_6` ADD INDEX ( `level` ) ;
- ALTER TABLE `destoon_buy_6` ADD INDEX ( `catid` ) ;
- ALTER TABLE `destoon_buy_6` ADD INDEX ( `username` ) ;
- ALTER TABLE `destoon_quote_7` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_quote_7` ADD INDEX ( `thumb` ) ;
- ALTER TABLE `destoon_quote_7` ADD INDEX ( `ip` ) ;
- ALTER TABLE `destoon_exhibit_8` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_exhibit_8` ADD INDEX ( `thumb` ) ;
- ALTER TABLE `destoon_exhibit_8` 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_brand_13` ADD INDEX ( `username` ) ;
- ALTER TABLE `destoon_job_9` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_job_9` ADD INDEX ( `vip` ) ;
- ALTER TABLE `destoon_job_9` ADD INDEX ( `addtime` ) ;
- ALTER TABLE `destoon_job_9` ADD INDEX ( `ip` ) ;
- ALTER TABLE `destoon_know_10` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_know_10` ADD INDEX ( `thumb` ) ;
- ALTER TABLE `destoon_know_10` 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_mall_16` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `vip` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `thumb` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `addtime` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `ip` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `hits` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `introduce` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `keyword` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `level` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `catid` ) ;
- ALTER TABLE `destoon_mall_16` ADD INDEX ( `username` ) ;
- ALTER TABLE `destoon_group_17` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_group_17` ADD INDEX ( `vip` ) ;
- ALTER TABLE `destoon_group_17` ADD INDEX ( `thumb` ) ;
- ALTER TABLE `destoon_group_17` ADD INDEX ( `addtime` ) ;
- ALTER TABLE `destoon_group_17` ADD INDEX ( `ip` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `thumb` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `addtime` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `ip` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `hits` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `introduce` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `keyword` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `level` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `catid` ) ;
- ALTER TABLE `destoon_article_21` ADD INDEX ( `username` ) ;
- 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_info_22` ADD INDEX ( `username` ) ;
- ALTER TABLE `destoon_news` ADD INDEX ( `status` ) ;
- ALTER TABLE `destoon_404` ADD INDEX ( `url` ) ;
- ALTER TABLE `destoon_404` ADD INDEX ( `addtime` ) ;
- ALTER TABLE `destoon_company` ADD INDEX ( `catid` ) ;
- ALTER 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_18 类似的模块内容全文最好都开启 其它的后台有提示
- ALTER TABLE `destoon_club_data_18` 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;