Home > Enterprise >  Should I paginate data query? Getting 5000 documents from firebase functions
Should I paginate data query? Getting 5000 documents from firebase functions

Time:09-30

Do I have to paginate the data query?

I need to send email notifications to 5000 users every day from firebase functions.

My first approach is:

  1. Make a query to firestore to get every user who must receive notification, making a .where() get.
  2. Send emails using a third party service.

how would you tell if you have to paginate the data? What would be a good practice?

Edit

Each document has 50 words.

Thanks for your time.

CodePudding user response:

Depending on how large you configured your Cloud Functions instances to be, and how big your documents are, you may or may not need* to paginate the results.

I typically prefer not to depend on such magic number though, so when I have more than a few thousand documents to process, I tend to process them in pages of a couple of hundred documents at a time.

  • Related