Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do the names/keys of documents and fields in Cloud Firestore affect my quota?

In the pricing overview for Cloud Firestore, it says (my bold highlight):

Pricing overview

When you use Cloud Firestore, you are charged for the following:

  • The number of reads, writes, and deletes that you perform.
  • The amount of storage that your database uses, including overhead for metadata and indexes.
  • The amount of network bandwidth that you use.

Does the statement in bold mean that if I use long names/keys for fields it will affect my quota? I take it that the field names are stored for each individual document, unlike a SQL-database where column names would only be stored once?

like image 547
Magnus Avatar asked Oct 31 '17 08:10

Magnus


1 Answers

Yes, that is correct. Field names are stored inline with the data and count towards storage size. We give full details in our Storage Size Calculations of the documentation.

Storage Size Calculations

Contents String size Document name size Field size Document size Index entry size What's next This page describes the storage size of documents, document names, fields, and index entries in Cloud Firestore.

You can learn about the costs of this storage at Cloud Firestore Pricing. String size

String sizes are calculated as the number of UTF-8 encoded bytes + 1.

The following are stored as strings:

  • Document names
  • Collection IDs
  • Namespace names (the default namespace has size 0)
  • Field names
  • String field values

For example:

  • The ID of the Task collection uses 4 bytes + 1 byte, for a total of 5 bytes.
  • The name of the description field uses 11 bytes + 1 byte, for a total of 12 bytes.
  • The name of the my_namespace namespace uses 13 bytes + 1 byte, for a total of 14 bytes.
like image 184
Dan McGrath Avatar answered Nov 15 '22 09:11

Dan McGrath