问题
On AWS Athena, I am trying to reuse computed data using a WITH clause, e.g.
WITH temp_table AS (...)
SELECT ...
FROM temp_table t0, temp_table t1, temp_table t2
WHERE ...
If the query is fast, the "Data scanned" goes through the roof. As if temp_table
is computed for each time it is reference in the FROM
clause.
I don't see the issue if I create a temp table separately and use it multiple times in the query.
Is there a way to really reuse a subquery multiple times without any penalty?
来源:https://stackoverflow.com/questions/54816300/reusing-subqueries-in-aws-athena-generate-large-amount-of-data-scanned