Does Firestore charge Cloud Function Get reads per retrieved documents?
在第一种情况下,Firebase是否会收取更多费用?
1 2 3 | collection().get() // potentially retrieves infinite documents collection().limit(smallerAmount).get() // only retrieve a smaller amount of documents |
在文档中,GCP内有一些未计费的流量,但是我不确定这是否适用于Firestore读取请求。
我假设Cloud Functions的计费方式与我的客户端的计费方式相同,并且通过
您的问题是问几个彼此之间并不真正相关的问题。
首先,文档读取与出口和入口不同。读取文档是简单地执行要求在Firestore中访问文档的查询的结果。它没有考虑发送该文档内容所需的网络数据量,这称为出口。
其次,出口仅通过从您的云服务传输的字节数来衡量。当数据停留在某个区域内时,可能不会向出口收费-有关此文件的说明将很清楚。出口与文档读取的计费无关。
第三,无论请求来自何处,文档读取都是收费的。可以将其视为使用Firestore索引快速进行查询的成本。它与出口无关,而与满足查询条件所必须触摸的文档数量有关。
第四,任何查询比另一个查询读取更多的文档,将花费更多。仅在必须将文档内容传输到客户端的文档读取中向您收费。
是的,第一种情况要比第二种情况要多。
正如您在文档中所指出的那样(即https://firebase.google.com/docs/firestore/pricing#operations):
When you listen to the results of a query, you are charged for a read
each time a document in the result set is added or updated. You are
also charged for a read when a document is removed from the result set
because the document has changed. (In contrast, when a document is
deleted, you are not charged for a read.)
由于您的结果集在第二种情况下较小(因为您使用
对于Cloud Functions读取Firestore数据的情况,如果Cloud Function的区域与Firestore所在的区域不同(并且不在同一多区域中),则您需要为区域之间的出口付费。再次查看您引用的文档以及https://firebase.google.com/docs/functions/locations#selecting_regions_for_firestore_and_storage
更新,来自下面的评论
对于Cloud Functions和Firestore之间的连接:
区域内的出口->免费,同一多区域内的区域之间的出口->免费,区域之间的出口(同一多区域内的NOT)->非自由,价格与美国或美国不同。有关各个区域的详细信息,请参见https://firebase.google.com/docs/functions/locations#selecting_regions_for_firestore_and_storage底部的表格
另请注意,目前,对于Firestore而言,唯一可用的多区域位置是我们中心位置,请参阅https://firebase.google.com/docs/firestore/locations