Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limitations on Cloud Firestore transactions

Tags:

I have read the docs regarding transactional update operations on Firestore. According to Quotas and Limits there are only two limits with regards to transactions:

  • Maximum size for a transaction: 10 MiB
  • Time limit for a transaction: 270 seconds, with a 60-second idle expiration time

There is no explicitly transaction-related limit mentioned, how many documents or collections can be read and/or modified during the transaction, or if there are any additional constraints on the collections in which the transactional updates happen.

  1. Does it mean, a client could do a transactional update on up to 500 documents, each in different collections, as long as the update stays inside these and the other general limits?

  2. If a client reads multiple documents inside a transaction, but only updates one of them - does Firestore still (silently) write into the unmodified documents (for serialization or so)... so I have to consider the write-limit of 1 write per document per second even for documents that have not been explicitly modified by the client.

P.S.: The reason I ask is that Datastore has a limit of 25 entity-groups in transactions, and also sees hotspots in entities ("documents") that are read-only inside many write transactions. For example, see this answer by Dan McGrath. I just wonder which of Datastore's characteristics carry over to Firestore and has to be considered when designing a Firestore database.

like image 797
Ani Avatar asked Oct 05 '17 12:10

Ani


1 Answers

See the line "Maximum number of documents that can be passed to a Commit operation" which defines a limit of 500 documents. This is your transaction limit as we need to apply everything in a transaction using a single commit.

I don't believe silent writes are required anymore to determine if a document has changed in a transaction.

There is no related limit that is equivalent to the 25 entity-group limit.

like image 57
Dan McGrath Avatar answered Nov 14 '22 23:11

Dan McGrath