Databricks-Spark-Assoc Using Spark SQL Practice Question
In Spark SQL, what is the primary difference between a temporary view and a global temporary view?
⚠ Common exam trap
Candidates often incorrectly believe global temporary views are persistent across cluster restarts or shared across different workspaces, rather than just being session-agnostic within the same cluster.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Temporary views are accessible only within the current session, while global temporary views are accessible across all sessions.
Understanding scope is critical for managing data access in multi-user Databricks environments. Temporary views are session-specific, ensuring data isolation between users. Global temporary views are visible to all sessions on the cluster and are stored in the 'global_temp' database. This distinction is vital for maintaining security and avoiding namespace collisions when multiple data engineers are working simultaneously on the same shared cluster infrastructure.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Temporary views persist after the cluster is terminated, while global temporary views do not.
Why it's wrong here
Neither view type persists after cluster termination. Both are volatile and exist only in memory during the lifetime of the Spark session or cluster. The difference between them relates strictly to visibility across sessions on the same cluster, not to persistence across cluster restarts or external storage lifecycle events.
- ✓
Temporary views are accessible only within the current session, while global temporary views are accessible across all sessions.
Why this is correct
Temporary views are bound to the specific Spark session that created them, ensuring isolation. Global temporary views are bound to the Spark application and are accessible by any session on the same cluster, allowing shared access to temporary datasets across different notebooks or users running on the same cluster.
- ✗
Temporary views are written to the Hive Metastore, while global temporary views are only in memory.
Why it's wrong here
Temporary views are not stored in the Hive Metastore; they are stored in the session catalog in memory. Global temporary views are also stored in memory under the 'global_temp' namespace. Neither is persisted in the metastore, which is reserved for permanent tables or managed views in the lakehouse catalog.
- ✗
Global temporary views are faster to query because they are cached by default.
Why it's wrong here
Neither view type is cached by default. Query performance depends on the underlying data source and the optimizer's ability to plan the execution. Adding the CACHE command to either type of view will improve subsequent query performance, but the view type itself provides no inherent speed advantage in Spark SQL.
About these practice questions
One of 295 original Databricks-Spark-Assoc practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-Spark-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-Spark-Assoc exam.