Databricks Data Analyst Associate · Section 5 · 15% of the exam
Utilize query history and caching to reduce development time and query latency
One of the objectives of the Databricks Certified Data Analyst Associate exam, in the section “Analyzing Queries”. Here is what it covers, the points to remember and a question to try.
What it covers
Learn what Photon is, which workloads it speeds up and which it cannot, how Query History saves development time, and how the result caches, disk cache and UI cache let Databricks SQL answer repeated queries faster.
Points to remember
- Photon = Databricks-native vectorized C++ engine; Catalyst still plans; no code changes; unsupported operations fall back to Spark transparently.
- Photon is the default engine of all SQL warehouses and is enabled on serverless compute and serverless pipelines; on classic compute it is the Use Photon Acceleration checkbox (
runtime_engine = PHOTON). - Biggest Photon gains: large scans, joins, aggregations and Delta/Parquet writes (MERGE, CTAS); stateless streaming is supported.
- No Photon for UDFs, RDD and Dataset APIs or stateful streaming; little gain for queries under about two seconds.
- Query History filters: user, date range, compute, duration, status, statement type, statement ID, query tags; details show full text, duration breakdown and query source; Cancel stops a running query.
Try a question
An analyst is tuning a slow query on a serverless SQL warehouse and needs every test run to measure real execution time, but repeated runs keep returning cached results. Restarting the warehouse between runs did not help. What should she do?
- ARun
CACHE SELECT * FROMthe table before each test run so that the cached data is refreshed - BSet
spark.databricks.io.cache.enabledto false so that the warehouse stops caching - CRun
SET use_cached_result = falsein the session she uses for testing - DMove the tests to a classic SQL warehouse because it does not have a result cache
Show the answer
C. SET use_cached_result = false disables query result caching for the session; Databricks recommends it only for testing and benchmarking. Restarting did not help because the remote result cache of serverless warehouses is persisted as workspace system data and survives stops and restarts.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Photon, query history and caching teaches this objective (about 40 minutes), and 13 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Understand the Features, Benefits, and Supported Workloads of Photon.
- Identify poorly performing queries in the Databricks Intelligence platform, such as Query Insights, Query Profiler log, etc.
- Utilize Delta Lake to audit and view history, validate results, and compare historical results or trends.
- Apply Liquid Clustering to improve query speed when filtering large tables on specific columns.
- Fix a query to achieve the desired results.