您的位置:首页 > 数据库 > MySQL

MYSQL execution time comparison(MYSQL 运行时间比较)-subselect vs select from 2 table

2007-04-24 14:13 549 查看
table t: device | lot |

table o: device

1. subselect==> 运行时间(execution time) = 6000 ms

select distinct device from t where lot = 'x'
and (device in (select distinct device from o where device like 'y%'));

2. select from 2 table==>运行时间(execution time) = 357ms

select distinct t.device from test_out_realtime t, opn_pbi_lot_view o where
t.lot='1548353' and o.device like '8660AU46%' and t.device=o.device;

由此可见:MYSQL subselect 运行速度很慢,所以能避免就要避免。大部分情况下,都可以通过select from 2 table 解决
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: