2つの大きなデータセットを結合するクエリを実行しようとしていますが、クエリの実行中にリソースが超過しています。 Join EachとGroupを使用すると回避策がありますが、回避策はありません。リソースクエリの実行中に超過しました
SELECT
year(users.firstseen) as first_year,
month(users.firstseen) as first_month,
DATEDIFF(orders.timestamp,users.firstseen) as days_elapsed,
count(orders.user_key) as count_orders
FROM
[project.orders] as orders
JOIN EACH
[project.users] AS users
ON
orders.user_key = users.user_key
WHERE orders.store = 'ios'
GROUP EACH BY 1,2,3
編集:次は働いた:
SELECT
year(users.firstseen) as firstyear,
month(users.firstseen) as firstmonth,
DATEDIFF(orders.timestamp, users.firstseen) as days_elapsed,
COUNT(users.firstseen) AS count_orders FROM [project.orders] as orders
JOIN EACH(SELECT user_key, firstseen FROM [project.users]
WHERE store_key = 'ios') as users ON orders.user_key = users.user_key
GROUP BY firstyear, firstmonth, days_elapsed
ORDER BY firstyear, firstmonth, days_elapsed
これは、 月firstyearとして SELECT年(users.firstseenを)働くことになりました( users.firstseen)firstmonth、days_elapsedとして DATEDIFF(orders.timestamp、users.firstseen)、 COUNT(users.firstseen)としてcount_orders FROM firstseen、注文ごと( SELECT user_keyをJOIN ようproject.orders] FROM AS [project.users] WHERE store_key = 'ios')ユーザーとしてorders.user_key = users.user_key GROUP BY firstyear、firstmonth、days_elapsed ORDER BY firstyear、firstmonth、days_elapsed – user2388120