sql 优化

explain
select oi.* from order_invoice oi
where
oi.id in(
select distinct iro.invoice_id from invoice_re_order iro,order_total ot where iro.total_code=ot.total_code and ot.user_id=74
);
sql 优化

 

 


explain
select oi.* from order_invoice oi
where
oi.id in(
select iro.invoice_id from invoice_re_order iro
inner join order_total ot on iro.total_code=ot.total_code and ot.user_id=74
);
sql 优化

 

 


explain
select distinct oi.* from order_invoice oi
inner join invoice_re_order iro on oi.id=iro.invoice_id and iro.total_code in (
select ot.total_code from order_total ot where ot.user_id=74
)
;
sql 优化

 

 


explain
select DISTINCT oi.* from order_invoice oi
inner join invoice_re_order iro on oi.id=iro.invoice_id
inner join order_total ot on iro.total_code=ot.total_code and ot.user_id=74

 

sql 优化

 

sql 优化

上一篇:初识Mysql触发器


下一篇:adb: error: remote object 'xxx' does not exist解决方法