Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase realtime DB - limitations of paths and keys?

In Firebase Realtime DB, what are the limits on:

  • keys
  • paths
  • nesting level

?

Meaning restrictions on lengths as well as disallowed/special chars/values. And any other restrictions (or discouragements) there might be.

Is this deprecated pre-Google-integration document (link here) still up to date?

Length of a key: 768 bytes

Depth of child nodes: 32

I don't see max path length mentioned there.

What is the non-deprecated location for this documentation?

I cannot find an equivalent in https://firebase.google.com/docs/ . As if some of the docs "got lost in the shuffle"...

Thanks for any hints.

EDIT: I've broadened it slightly - not just lengths but any restrictions that might apply.

like image 512
KarolDepka Avatar asked Jan 28 '17 13:01

KarolDepka


People also ask

What are the Realtime Database limits in Firebase?

256 MB from the REST API; 16 MB from the SDKs. The total data in each write operation should be less than 256 MB. Multi-path updates are subject to the same size limitation. The total bytes written through simultaneous write operations on the database at any given time.

What are the restrictions in Firebase?

Firebase Security Rules work by matching a pattern against database paths, and then applying custom conditions to allow access to data at those paths. All Rules across Firebase products have a path-matching component and a conditional statement allowing read or write access.

Is Firebase Realtime Database scalable?

Realtime database shardingYou can use up to 1000 instances at the same time, thus reaching incredible scalability.

Is Firebase a key value database?

Firebase uses a very popular style of NoSQL database: Key-value stores. The concept is not so complicated once you know the basic JSON syntax.


2 Answers

The Firebase documentation says 768 bytes is still the limit for a Key, and that they use UTF-8 encoding. With UTF-8, a character is 1-4 bytes.

However, most characters are 1 byte, unless you use a character such as ♥, which is 3 bytes. Therefore, for normal use of a key, the character limit is 768. If you want to anticipate some outlandish characters, it may be best to be conservative and limit total characters to 500 ,600, or 700. Depends on how you want to use the keys.

Test your characters and strings here: https://mothereff.in/byte-counter

Documentation here: https://firebase.google.com/docs/database/usage/limits

like image 163
Jeff Padgett Avatar answered Sep 19 '22 23:09

Jeff Padgett


This documentation mentions that firebase realtime database can be nested up to 32 levels. But as its mentioned there itself that it is not a good practice to nest your data. Denormalisation of data though seems redundant, it gives more flexibility when writing rules and when writing queries to the database.

like image 25
Sourav Kannantha B Avatar answered Sep 23 '22 23:09

Sourav Kannantha B