0

I have uploaded a huge data to Firestore emulator but I'm not getting any size limit error

How the document looks (Array length of 6) enter image description here

When I upload Array length of 120,000 the website gets hanged. But I have no problem retrieving it and displaying it in the console enter image description here

And according to the Storage size calculations, an integer is 8 bytes.. therefore my document is greater than 8 * 10 * 120000 = 9.6MB, But i have no problem uploading it and retrieving it.

Where have I done wrong?

Ibrahim Ali
  • 2,083
  • 2
  • 15
  • 36
  • why are you multiplying by 10? shouldn't it be 8 * 120000 = 96000 which is 0.091552734375 MB. But even if you multiply by 10 you will get 0.91552734375 MB which is less then 1 – Liat May 29 '22 at 14:50
  • @Liat `1Mb = 1,000,000b`... `8*120000=960,000`... A single integer is 8 bytes, 10 integer is 8*10 – Ibrahim Ali May 29 '22 at 15:04
  • it is 1 number not 10 numbers. 960,000 is less then 1 Mb – Liat May 30 '22 at 06:59

1 Answers1

0

11111111 is a single number, not 10 numbers. 10 is the number of digits in that number, which doesn't really mean anything to Firestore, and is irrelevant to the way that numbers are stored in binary systems. It just must be within the upper and lower bounds of a 64 bit signed integer range.

It costs 8 bytes to store any number value. In the documentation it says that integers are 64 bit signed values. It might help to learn about how integers are coded in binary for the given maximum number of bits to use.

The calculation you're trying to perform is just 8 (bytes per number) * 120000 (numbers in the array). You should add some overhead (for example, the size of the id of the document and the name of the field), as described in the documentation.

If you think there is an error in the emulator, then you should file a bug there with your observations instead of posting to Stack Overflow.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441