1,朋友找我帮忙看下比拟慢的sql语句
SELECT
pg.product_goods_id,
pg.product_id,
pg.pdt_code,
pg.pdt_name,
pg.brand_name,
pg.reference_price,
pg.deposit,
pg.sale_status,
pg.is_delete,
pg.create_date,
pg.create_operator,
pg.update_date,
pg.update_operator,
si.shop_id,
si.shop_name,
pg.goods_img_url,
pg.is_bargain,
pg.qr_code_url,
(
SELECT
COUNT(*)
FROM
product_attention pa
WHERE
pa.product_goods_id = pg.product_goods_id
AND `status` = 0
) AS laud,
pc.category_name,
pg.is_experience,
pg.deposit,
pg.buy_type,
pg.content,
pg.assure_flag,
pg.market_price,
pg.qty_cnt,
pg.sales_cnt
FROM
product_goods pg
LEFT JOIN shop_info si ON si.shop_id = pg.shop_id
LEFT JOIN product_category pc ON pc.category_id = pg.category_id
WHERE
si.market_id IN (1, 2, 3, 12, 13)
ORDER BY pg.update_date DESC , pg.product_goods_id DESC
LIMIT 0,
20;
SELECT
pg.product_goods_