I have a database that store could potentially store LOTS of user individual data. I am working with Firebase and wondering how best to fetch my data.
For example, I have a machine, cog, gear, gizmo, screw, and bolt nodes in my database. One machine node has a relationship to several of these others.
machines: {
abc: {
cogUid: 123456789
gearUid: 123456789
gizmoUid: 123456789
screws: {
a: 123
b: 456
c: 789
}
}
def: {
...
}
ghi: {
...
}
}
When I fetch all of my machine nodes to display in a list, I also need to fetch all the related nodes using their uid's. For example, a list of machines, also shows next the machine the name of the cog and gizmo.
What is the most efficient way of retrieving all this data? If I fetch 500 machines and then need to do 5 more individual fetches per machine for their related data, that's a TON of fetches.