title: When to persist and when to unpersist RDD in Spark
body: <p>Lets say i have the following: </p>
  
  <pre><code> val dataset2 = dataset1.persist(StorageLevel.MEMORY_AND_DISK) 
   val dataset3 = dataset2.map(.....)
  </code></pre>
  
  <p>If you do a transformation on the dataset2 then you have to persist it and pass it to dataset3 and unpersist the previous or not?</p>
  
  <p>I am trying to figure out when to persist and unpersist RDDs. With every new rdd that is created do i have to persist it?</p>
  
  <p>Thanks</p>