What's the difference between a Global view and a Temp view?

User15787040559
Databricks Employee
Databricks Employee

The difference between Global and Temp is how the lifetime of the view is tied to the application:

http://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.DataFrame.createOrReplaceTe...

Creates or replaces a local temporary view with this DataFrame.

The lifetime of this temporary table is tied to the SparkSession that was used to create this DataFrame.

http://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.DataFrame.createOrReplaceGl...

Creates or replaces a global temporary view using the given name.

The lifetime of this temporary view is tied to this Spark application.