t是小表 s是大表
SELECT s.id,s.nick,s.userId,s.sid,s.session_key,s.retoke,s.shouquantime,s.refresh_token_timeout,s.timezone,t.endtime
from taobao_session as s
LEFT JOIN taobao_productrepost_set as t
on t.memberId=s.sid
where 1
and s.sid<>''
and (s.refresh_token_timeout<=0 or s.refresh_token_timeout>=unix_timestamp(now()))
and s.sj_kaiguan=1
order by t.reposttime asc,t.publishednum asc LIMIT 0,200
优化前 受影响的行: 0
时间: 11.123ms
SELECT s.id,s.nick,s.userId,s.sid,s.session_key,s.retoke,s.shouquantime,s.refresh_token_timeout,s.timezone,t.endtime
from taobao_productrepost_set as t
LEFT JOIN taobao_session as s
on t.memberId=s.sid
where 1
and s.sid<>''
and (s.refresh_token_timeout<=0 or s.refresh_token_timeout>=unix_timestamp(now()))
and s.sj_kaiguan=1
order by t.reposttime asc,t.publishednum asc LIMIT 0,200
优化后 受影响的行: 0
时间: 0.025ms
DELETE t,i FROM `taobao_custom_trade` as t join taobao_custom_trade_item as i on t.tid=i.tid where t.sellerUserId ='';
联合删除
SELECT `subject`,supplierLoginId,`categoryName` FROM `taobao_product0` WHERE CONCAT(`subject`,supplierLoginId,`categoryName`) LIKE '%你%' 多字段模糊搜索