Home > Software engineering >  Firebase Firestore data bundles for reducing reads with interval queries
Firebase Firestore data bundles for reducing reads with interval queries

Time:01-08

Suppose the client has the ability to query fresh data from Firebase Firestore every X minute intervals otherwise it comes from cache. Additionally, each of these regular queries requires queries from 4 separate collections. I am trying to reduce the number of reads, so my thought is using data bundles, but want to make sure I am understanding this correctly.

If my server side code is normally generating fresh data every X minutes, and then writing to the respective collections/documents in Firestore... is it, in fact, more efficient to have my server side code using admin SDK to make the new bundle (for the 4 collections) every X minutes, or am I just wasting my time, and should have my client make the four separate requests?

CodePudding user response:

If you have multiple client querying the same collections and getting documents, then building a bundle with that same content and distributing that to those clients will indeed lead to fewer charged document reads from Firestore.

If your criteria for efficiency is the number of document reads, that would indeed also make it more efficient.

  • Related