mysql - 慢查询如何优化
黄舟
黄舟 2017-04-17 14:50:11
0
3
596

mysql慢查询语句该如何优化

SELECT * FROM `x_order` LEFT JOIN x_goods ON x_goods.goods_id = x_order.order_goodsid WHERE `order_isdelete` = 0 AND `goods_type` = 0 GROUP BY order_no
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
PHPzhong

Build an index
order_isdelete goods_type order_no goods_id
Consider how to build an index to optimize the query for these fields.

大家讲道理

Where group by select, try to do it on the index

阿神
  1. Try not to use JOIN and migrate functions from SQL to code level processing

  2. Index

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!