Производительность запроса в отношении того, какой вариант лучше из двух: 1) с запросом или 2) временная таблица
1)
with table_map as ( select * from t1 where x=y),
select col1, sum(col) from table_map group by 1
union all
select col2, sum(col) from table_map group by 1
union all
select col3, sum(col) from table_map group by 1
2)
create temp table tmp_details as (select * from t1 where x=y)
select col1, sum(col) from tmp_details group by 1
union all
select col2, sum(col) from tmp_details group by 1
union all
select col3, sum(col) from tmp_details group by 1