PROFESSIONAL-DATA-ENGINEER practice question 8 of 10

Which of these statements about BigQuery caching is true?

Full set: 401 questions
Answer options
A: By default, a query's results are not cached.
B: BigQuery caches query results for 48 hours.
C: Query results are cached even if you specify a destination table.
D: There is no charge for a query that retrieves its results from cache. Correct answer
Correct Answer:
D. There is no charge for a query that retrieves its results from cache.
Explanation

BigQuery automatically caches the results of queries that have been run previously. When an identical query is submitted again, BigQuery can retrieve the results directly from this temporary cache. This process is significantly faster than re-executing the query. Because no data is processed for a cached query, there is no charge for on-demand analysis when the results are served from the cache. The job statistics will indicate a cacheHit.

Why Incorrect

A. By default, a query's results are not cached. This is incorrect. Query result caching is an automatic feature and is enabled by default in BigQuery to improve performance and reduce costs.
B. BigQuery caches query results for 48 hours. This is incorrect. BigQuery caches query results for approximately 24 hours, but the cache is a best-effort mechanism and may be invalidated sooner.
C. Query results are cached even if you specify a destination table. This is incorrect. When a query specifies a destination table for its results, the query is always executed, and the cache is not used.

References

1. Google Cloud Documentation, BigQuery, "Using cached query results":

"When you run a query, BigQuery checks to see if the query results are in the cache... Retrieving results from the cache is much faster than running the query, and there is no charge for cached queries."

"Query results are cached for 24 hours."

Under the "Limitations" section: "You can't use the query cache in the following situations: ... When a destination table is specified."

2. Google Cloud Documentation, BigQuery, "Control costs in BigQuery":

Under the "Avoid running the same query multiple times" section: "BigQuery writes all query results to a table... If you submit the exact same query again, BigQuery will retrieve the results from the cached results table, and you will not be charged for the query."

3. Google Cloud Documentation, BigQuery, "Introduction to BigQuery jobs":

Under the statistics.cacheHit field description: "If true, indicates that the query result was fetched from the query cache." This confirms the mechanism for identifying a cached query.

Scroll to Top