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 解决
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 解决
相关文章推荐
- mysql 时间戳格式化函数from_unixtime
- mysql 中 unix_timestamp和from_unixtime 时间戳函数
- memcached vs MySQL Memory engine table 速度比较_XMPP Jabber即时通讯开发实践_百度空间
- 一种最坏情况线性运行时间的选择算法 - The missing worst-case linear-time Select algorithm in CLRS.
- MySql create table ... as select * from ..
- Mysql创建视图 :View's SELECT contains a subquery in the FROM clause
- FROM_UNIXTIME 格式化MYSQL时间戳函数
- UCenter info: MySQL Query Error SQL:SELECT value FROM [Table]vars WHERE noteexists
- FROM_UNIXTIME 格式化MYSQL时间戳函数
- FROM_UNIXTIME 格式化MYSQL时间戳函数
- mysql 时间戳格式化函数from_unixtime使用说明
- 格式化MYSQL时间戳函数FROM_UNIXTIME
- Mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中)。
- mysql 创建视图出现1349 View's SELECT contains a subquery in the FROM clause解决办法
- memcached vs MySQL Memory engine table 速度比较
- mysql中UNIX_TIMESTAMP和FROM_UNIXTIME时间戳
- mysql版本 5.6.10,UNIX_TIMESTAMP和FROM_UNIXTIME支持最大时间戳转换
- MYSQL中的FROM_UNIXTIME,再也不用担心时间戳。
- mysql 细微点汇总select group_concat(b) as b_str from table
- FROM_UNIXTIME 格式化MYSQL时间戳函数