我正在尝试运行加入 2 组大型数据的查询,并且在查询执行错误期间遇到了超出的资源。我读过在使用 Join Each 和 Group Each 时有一些解决方法,但不是那些解决方法。
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