When should we avoid caching DataFrames in Databricks?

fatimak01
New Contributor

Caching is generally recommended when we reuse a DataFrame multiple times. However, there seem to be situations where caching actually increases the execution time.

How do we identify whether a DataFrame is worth caching?

Also, what happens when the cached DataFrame is larger than the available executor memory? Is persist() with a different storage level a better option in such cases?