In firebase database I created a database call "orders". The data to be stored has following format:
{
cost: orderCost,
createdAt: createdAt,
}
In firebase, the tree is like below:
What I want to achieve is to quickly get the sum of cost in recent 7 days, or 30 days based on createAt
timestamp.
What I think of is to create the index for createdAt
, and run query based upon it.
But what if the dataset is huge, say several million entries, is it still efficient to run the above query?
Please kindly give your advise. Thanks!