t1, t2 均为查询出来的临时表
t1 10亿条数据
t2 10万条数据
应把 t2 (小表) 放在前面 节省运算
select t1.col1, t2.col2, t2.key
from
( select col2, key from test_table2 ) t2
join
( select col1, key from test_table1 ) t1
on t1.key=t2.key
t1, t2 均为查询出来的临时表
t1 10亿条数据
t2 10万条数据
应把 t2 (小表) 放在前面 节省运算
select t1.col1, t2.col2, t2.key
from
( select col2, key from test_table2 ) t2
join
( select col1, key from test_table1 ) t1
on t1.key=t2.key