今天一个SHOPNC商城突然变慢,查看服务器情况,发现MYSQL占用181%CPU,然后查看PHP慢查询,发现这样的内容
[22-Nov-2016 20:55:41] [pool www] pid 50624 script_filename = /home/xxxx/public_html/mobile/index.php [0x00007fcc47bad470] query() /home/xxx/public_html/core/framework/db/mysqli.php:90 [0x00007fcc47bad308] query() /home/xxxx/public_html/core/framework/db/mysqli.php:115 [0x00007fcc47bad190] getAll() /home/xxxx/public_html/core/framework/libraries/model.php:651 [0x00007fcc47bad070] select() /home/xxxx/public_html/core/framework/libraries/model.php:304 [0x00007fcc47bacf78] find() /home/xxxx/public_html/data/model/mb_user_token.model.php:24 [0x00007fcc47bace98] getMbUserTokenInfo() /home/xxxx/public_html/data/model/mb_user_token.model.php:31 [0x00007fcc47bacd78] getMbUserTokenInfoByToken() /home/xxxx/public_html/mobile/control/control.php:68 [0x00007fcc47bacc70] __construct() /home/xxxx/public_html/mobile/control/member_index.php:16 [0x00007fcc47bacb48] __construct() /home/xxxx/public_html/core/framework/core/base.php:88 [0x00007fcc47baca40] control() /home/xxxx/public_html/core/framework/core/base.php:46 [0x00007fcc47bac978] run() /home/xxxx/public_html/mobile/index.php:26
这是第三方登陆用到的,然后我查看了 mb_user_token 这表,发现居然没有索引,把 token 这个字段加个索引,解决问题
时间: 2024-10-23 15:58:11