title: Bigquery SQL - Is it better to unnest in SELECT or JOIN?
body: <p>I have a dataset where views are nested inside of sessions and I want a count of views for each session. What is the more efficient/proper way to structure such a query?</p>
  
  <p>Is there any documentation that talks about the preferred way to write queries in BigQuery SQL? </p>
  
  <pre><code>SELECT session_key, ( SELECT COUNT( view_id ) FROM UNNEST( views ) views ) AS view_count 
  FROM sessions 
  WHERE _PARTITIONTIME &gt;= TIMESTAMP( '2016-04-01' ) ;
  
  SELECT session_key, COUNT( view_id ) AS view_count 
  FROM sessions 
    LEFT JOIN UNNEST( views ) views 
  WHERE _PARTITIONTIME &gt;= TIMESTAMP( '2016-04-01' ) 
  GROUP BY session_key; 
  </code></pre>
  
  <p>Thank you</p>