问题
I am currently using Cloud Functions to do aggregation in Firebase so that whenever a certain type of data entry occurs, I aggregate it accordingly and store it to show our reports. There are following concerns with this approach:-
- Adding new reports would mean going over all the existing data and that could be expensive with firebase realtime database
- Making any changes to existing reports is also non-trivial
I was considering a solution like Cloud Dataflow. However, one issue is that it is not part of the Spark or Flame plan of Firebase.
What is the best way to handle reporting with firebase, keeping both cost and performance in mind?
回答1:
Recommending a specific reporting solution is off-topic on Stack Overflow.
But in general I recommend separating your active data (that users need to access directly) from your historical data (that you keep mostly for reporting). Keep your active data in your Firebase Database, which is optimized for synchronizing data between users. Then keep your historical data in a separate data store that is optimized for reporting.
A quite common combination is to keep the historical data in BigQuery and then aggregate the data there. You can then write the aggregated data back to your Firebase Database, to make it available to your users.
来源:https://stackoverflow.com/questions/44920202/what-is-the-best-way-to-show-reports-with-firebase