Is it possible to efficiently retrieve schedules from a database with thousands, or even millions, of records in the future?
I am planning on storing schedules from healthcare professionals in a collection, but I am unsure if it is better to store them within the professional's entity or within the unit itself.
While Firebase allows for the creation of indexes, I am concerned about retrieving schedules in a simple manner.
1. Initial Approach:
db.collection('unity').doc('6BfbptQ8blacBLi1GNIJ').collection('schedules').
2. Alternative Approach:
db.collection('unity').doc('6BfbptQ8blacBLi1GNIJ')
.collection('professionals').
doc('Z6JDd0Ek7WO8yqiZJkBuJooF1FH3')
.collection('schedules').
The second way would require traversing through all professionals in the unit to gather their schedules and aggregating the counts, which might not be optimal.
I am curious about the performance implications when dealing with collections containing thousands or millions of records.