Я пытаюсь запустить запрос, соединяющий два больших набора данных, и я поражаю ресурсы, превышенные при ошибке выполнения запроса. Я читал, что есть работа вокруг, когда вы используете Join Every и Group Every, но не об этом.
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