I have BigQuery database and see an error after 30 seconds of execution :
Query exceeded resource limits. 34012.91515312311 CPU seconds were used, and this query must use less than 20200.0 CPU seconds.
when using such query:
SELECT
b.date as Date,
SUM(b.revenue) as Revenue
FROM `dataset.a` a
JOIN `dataset.b` b ON b.id = a.low_id OR UPPER(b.id) = a.high_id
WHERE DATE(a.date_and_time) >= DATE('2020-02-01')
AND DATE(a.date_and_time) <= DATE('2020-02-25')
GROUP BY b.date
ORDER BY b.date
I noticed that if I remove grouping and just return b records, it will work and last for 40 seconds.
But when I remove b.id = a.low_id or UPPER(b.id) = a.high_id from the JOIN it works and lasts for 3 seconds!
Could you please explain such behaviour? And is it real to make this query work without buying additional slots?
ORkills query performance. And why do you need to useUPPER()on theid-- but only for one comparison? - Gordon Linoffadvertising_idthet matches android_id field or apple_id field in upper case from table a. Each b recod also has a revenue and date. I want to see revenue by date for specific dates. Each table size is 250 mb - Alex Zaitsev