I'm using the following method to delete a Cloud Firestore collection as explained here.
deleteCollection(
final CollectionReference collection,
final int batchSize,
Executor executor)
I have tried to use each one of the following three Executors
and it works fine with which one of them.
ExecutorService executorService = Executors.newFixedThreadPool(5);
ExecutorService executorService = Executors.newCachedThreadPool();
ExecutorService executorService = Executors.newSingleThreadExecutor();
Which one is recomended to be more efficient and used when calling deleteCollection()
method? Or is there a better one?
What is the recommended batchSize
we need to use to avoid out-of-memory errors?
Thnak you in advance!
The sample code you see there for Android comes directly from this code in GitHub. Digging around in there, you can see that the sample coded uses the following Executor:
Whether or not that's the best possible case for your particular situation, that's not really possible to say.
Regarding the batch size, the documentation also suggests that you need to make a judgement call:
Given that we don't really know your specific situation, it's not really possible to give an answer that definitively gives you a best-possible solution.