我在sql查询中使用了三个UNION。查询需要很多时间。还有其他更快的选择吗?我的数据库是Vertica,我用Tableau编写了查询。
选择查询如下所示-
(select A,B,C from (select fun(X) as A, B,C,D from table1 where condition1 group by B,C,D)alias where condition2)
UNION
(select A,B,C from (select fun(X) as A, B,C,D from table1 where condition1 group by B,C,D)alias where condition3)
]
UNION
[
(select A,B,C from (select fun(X) as A, B,C,D from table1 where condition1 group by B,C,D)alias where condition4)
UNION
(select A,B,C from (select fun(X) as A, B,C,D from table1 where condition1 group by B,C,D)alias where condition5)