9.3.8 行列过滤

9.3.8.1 列处理

SELECT中,只拿需要的列,如果有,尽量使用分区过滤.

尽量避免SELECT *


9.3.8.2 行处理

在关联时, 可以先用 where 过滤, 再连接两张表.

  1. 测试先连接两张表,再用 where 条件过滤

    select o.id 
    from bigtable b join ori o 
    on o.id = b.id
    where o.id <= 10;
    

  2. 通过子查询后,再连接表

    select b.id from bigtable b
    join (select id from ori where id <= 10 ) o on b.id = o.id;
    

Copyright © 尚硅谷大数据 2019 all right reserved,powered by Gitbook
该文件最后修订时间: 2018-11-20 18:14:22

results matching ""

    No results matching ""