|
|
问个问题,建了个配置表,表名是tmp_config,里面有2个字段,一个就是prodid,一个是is_group, prodid 里面就是 '-spidsdd','-yyyesdd','-umgfss'.....
这个tmp_config的prodid有150条记录
is_group 只有3个值 0,1,2
但是我发现建中间表如果这样写的话
create table tmp_01
as
select */parallel(8)/* distinct a.* from tb_name(
这个表很大
) a,(select prodid from tmp_config where is_group = 1) b where a.prodid = b.prodid;
运行起来,一直不出结果,但是如果我把它写死进去,哪怕写死进去100个,也是分分钟就出来了,就像select */parallel(8)/* distinct a.* from tb_name a where prodid in (select prodid from tmp_config where prodid in ('-spidsdd','-yyyesdd','-umgfss'.......)),但这样肯定不科学,有啥好办法吗? |
|