Latcie
Latcie

Reputation: 701

Firebase storage best practices

I have a flat database structure as is suggested, but I'm not sure if the same practice should be used for storage as well.

It's not too much trouble for me to just do:

FIRStorage.storage().reference().child(someUID).child(someNode1).child(someNode2) and so on and so on

But is this the best practice? Should I try to flatten out the storage structure as well?


EDIT BELOW

Would it be safe to say that it's okay to have something like this, then:

root
  |
  'uid1
      |
      'Group 1
            |
            'Thousands of pictures
      |
      'Group 2
            |
            'Thousands of pictures
      .
      .
      .
  |
  'Thousands more UIDs

In other words, breadth and depth of storage doesn't matter, corret?

Upvotes: 2

Views: 587

Answers (1)

Bradley Mackey
Bradley Mackey

Reputation: 7668

You won't see any performance improvements by flattening your Firebase Storage structure. This is because the way you retrieve data from Firebase Storage (only the requested files are downloaded) is very different to that of the Realtime Database (all child data is returned for some data request).

Therefore, you can structure the Storage data any way that makes the most sense to your use case.

Upvotes: 2

Related Questions