quent
quent

Reputation: 2185

How optimize Firebase database size

I'm new with Firebase technology and I would like to optimize Firebase database size (including for decrease cost).

What are the different ways to decrease Firebase database size?

Can I simply use node names as short as possible, for example instead of having a node "user", rename this node "u"? (relevant if this node is very present)

Do there are other tips?

Upvotes: 2

Views: 616

Answers (1)

PlusInfinite
PlusInfinite

Reputation: 206

Here's the approach we take from one of our mobile apps:

  • We have a mobile app, web service, Firebase Database and Firebase Storage. We sometimes have a small SQL database as well.
  • We have the mobile app display data from Firebase but write data to Firebase via the web service, never directly.
  • We started with using Firebase Database as our storage, then changed to a hybrid Firebase Database + Firebase Storage mix.
  • We now store the "view data" is Firebase Storage and only store a "stub/pointer" in the Firebase Database (it reduces data size and it reduces traffic).

We end doing an extra read from Firebase Storage every time the value of a "stub/pointer" changes in Firebase Database, but that works for our scenario. We also don't do it for every situation, so we peek and chose where it makes sense to use this approach.

We ended up reducing cost - that was our main reason to search for a solution and it looks like that's your motivation as well.

Other than that, using short names for the key names may help as well.

Upvotes: 2

Related Questions