云Firestore事务的限制 [英] Limitations on Cloud Firestore transactions

本文介绍了云Firestore事务的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读有关 Firestore上事务性更新操作的文档

一>。根据配额和限额,交易只有两个限制:



  • 交易的最大尺寸:10 MiB

  • 交易的时间限制:270秒,空闲到期时间为60秒


没有明确的交易相关限制提及,在交易过程中可以读取和/或修改多少个文档或集合,或者对事务更新发生的集合有任何附加限制。


  1. 这是否意味着客户可以对最多500个文档进行事务更新,每个文档都在不同的集合中,只要更新保持在这些限制和其他一般限制内?


  2. 如果客户端在事务内部读取多个文档,但只更新其中一个文档 - Fires (静默地)写入未修改的文档(用于序列化等)...所以我必须考虑每秒每写入一次写入的写入限制,即使对于未被客户机明确修改的文档。 p:


PS:我问的原因是数据存储在事务中有25个实体组的限制,并且还看到热点在许多写入事务中只读的实体(文档)。例如,请参阅Dan McGrath的此答案。我只是想知道Datastore的哪些特性可以传递给Firestore,并且在设计Firestore数据库时必须考虑到它。

可以传递给Commit操作的最大文档数量,它定义了500个文档的限制。这是您的交易限制,因为我们需要使用单个提交将所有内容应用于交易。



我不认为无需再进行静默写入来确定文档是否具有

没有相关的限制,相当于25个实体组的限制。


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.

解决方案

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.

这篇关于云Firestore事务的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆