cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to disable all cache

Brad
Contributor II

Hi, 

I'm trying to test some SQL perf. I run below first

spark.conf.set('spark.databricks.io.cache.enabled', False)

 However, the 2nd run for the same query is still way faster than the first time run. Is there a way to make the query start from a clean beginning without any cache?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

VZLA
Databricks Employee
Databricks Employee

Hi @Brad ,

It is not clear which cache storage is helping with running your query faster, so the most straightforward way is to reset the sparkContext. Alternatively, these are the three clear cache ways I can think from the top of my head:

// Clear all persistent RDDs from memory, you can verify its effectiveness by monitoring the Storage Tab in the Spark UI

spark.sparkContext.getPersistentRDDs.values.foreach(_.unpersist())

// Disable Databricks IO cache as you are currently doing.

spark.conf.set("spark.databricks.io.cache.enabled", false)

// Clear any cached tables or views if that is what its helping

spark.catalog.clearCache()

View solution in original post

2 REPLIES 2

VZLA
Databricks Employee
Databricks Employee

Hi @Brad ,

It is not clear which cache storage is helping with running your query faster, so the most straightforward way is to reset the sparkContext. Alternatively, these are the three clear cache ways I can think from the top of my head:

// Clear all persistent RDDs from memory, you can verify its effectiveness by monitoring the Storage Tab in the Spark UI

spark.sparkContext.getPersistentRDDs.values.foreach(_.unpersist())

// Disable Databricks IO cache as you are currently doing.

spark.conf.set("spark.databricks.io.cache.enabled", false)

// Clear any cached tables or views if that is what its helping

spark.catalog.clearCache()

Brad
Contributor II

Thanks @VZLA . How to run

spark.sparkContext.getPersistentRDDs.values.foreach(_.unpersist())

from databricks notebook?

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group