Firestore读/写定价; .limit(25)算作25次读取还是一次? [英] Firestore read/write pricing; does .limit(25) counts as 25 reads or one?

查看:64
本文介绍了Firestore读/写定价; .limit(25)算作25次读取还是一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于诸如以下查询之类的查询,对于Firestore定价是一次读取还是25次读取,我有些困惑.

I am a bit confused as to whether a query like the one below counts as one read or 25 reads for Firestore pricing ?

queryRef.limit(25).get().then(()=>{

...

});

我了解到,在定价图表中,文档读取"已定义为单元,但对于上述查询我有些困惑,需要确认.

I understand that in the pricing chart a "document read" has been defined as the unit but I am a bit confused about a query like above and need a confirmation.

推荐答案

如果查询返回1个文档,则将向您收取1次读取的费用.如果查询返回25个文档,则将向您收取25次读取的费用.在查询中,文档没有被读取"的内容,在使用偏移量跳过文档的情况下,例外除外.根据文档:

If your query returns 1 document, you will be charged 1 read. If your query returns 25 documents, you will be charged 25 reads. A document does not have the be "read" to be omitted in a query, except in the case of using an offset to skip documents. According to the documentation:

使用游标,页面令牌和 限制.实际上,这些功能可以帮助您通过阅读节省金钱 仅您实际需要的文档.

There are no additional costs for using cursors, page tokens, and limits. In fact, these features can help you save money by reading only the documents that you actually need.

但是,当您发送包含偏移量的查询时, 为每个跳过的文档收费.例如,如果您的查询 使用10的偏移量,查询返回1个文档,您是 收取11次读取.由于这笔额外费用,您应该使用 游标而不是偏移量.

However, when you send a query that includes an offset, you are charged a read for each skipped document. For example, if your query uses an offset of 10, and the query returns 1 document, you are charged for 11 reads. Because of this additional cost, you should use cursors instead of offsets whenever possible.

这篇关于Firestore读/写定价; .limit(25)算作25次读取还是一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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