google-cloud-platformcachinggoogle-bigquerydatabase-viewdatabase-caching

Understanding Bigquery caching for views


In BQ, if we are querying from the view z which is say for example select * from x join y and we want to do:

select a from z where <where_clause> and select b from z where <where_clause_2>

Will the results of the view z be cached?

i.e. Under the hood,

Is it

select a from z where <where_clause> = select a from x join y where <where_clause> (where x join y is cached for the next query)

and select b from z = select b from z' where <where_clause_2> (where z' is cached z) [NOTE]

OR

will it be select a from z = select a from x join y where where_clause_2 and select b from z = select b from x join y where where_clause_2


Solution

  • As mentioned in the documentation, the cache applies with the exact same request.

    Here, you reuse a part of a request and the cache does not apply on the part of request.