Firestore:如何“读取"数据?计算配额? [英] Firestore: How are "reads" calculated for the quota?
问题描述
我不明白"firestore"如何计算配额和账单的读取次数.
I don't understand the way "firestore" counts the reads for the quota and billing.
示例:我有一个包含200'000个文档的集合.每个文档都有一个时间戳作为属性.现在,我想在过去一小时内得到所有文件.因此,我创建了一个查询,该查询为我提供了所有带有时间戳> now()-60分钟"的文档.结果是一组10个文档. Firestore是否为此计算10个文档读取或200'000个文档读取? 我想建立一个查询,该查询总是读取一次文档(获取而不是实时).
Example: I have a collection with 200'000 documents. Every document has a timestamp as attribute. Now I would like to get all documents within the last hour. So I create a query which gives me back all documents with "timestamp > now()-60 minutes". The result is a set of 10 documents. Does Firestore counts 10 document reads or 200'000 documents read for this? I would like to build a query that read a document always once (fetch, not real time).
我认为Firestore乍一看只是比其他解决方案(例如Google Cloud sql,aws等)便宜的解决方案.
I assume that firestore is only at the first view a cheaper solution than with other solution (e.g. google cloud sql, aws etc).
推荐答案
要允许该查询,您需要在timestamp
上具有索引. Firestore使用该索引来确定要返回的文档.因此,这将算作10次文档读取.
To allow that query, you will need to have an index on timestamp
. Firestore uses that index to determine what documents to return. So this would count as 10 document reads.
这篇关于Firestore:如何“读取"数据?计算配额?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!