Getting the count of records in a data frame quickly
It’s going to take so much time anyway. At least the first time. One way is to cache the dataframe, so you will be able to more with it, other than count. E.g df.cache() df.count() Subsequent operations don’t take much time.