title: BigQuery Query exceeded resource limits. when using joins with OR
body: <p>I have BigQuery database and see an error after 30 seconds of execution :</p>
  
  <blockquote>
    <p>Query exceeded resource limits. 34012.91515312311 CPU seconds were
    used, and this query must use less than 20200.0 CPU seconds.</p>
  </blockquote>
  
  <p>when using such query:</p>
  
  <pre><code>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) &gt;= DATE('2020-02-01')
  AND DATE(a.date_and_time) &lt;= DATE('2020-02-25')
  
  GROUP BY b.date
  ORDER BY b.date
  </code></pre>
  
  <p>I noticed that if I remove grouping and just return <code>b</code> records, it will work and last for 40 seconds.
  But when I remove <code>b.id = a.low_id</code> or <code>UPPER(b.id) = a.high_id</code> from the JOIN it works and lasts for 3 seconds!</p>
  
  <p>Could you please explain such behaviour?
  And is it real to make this query work without buying additional slots?</p>