一些Firestore配额的误解 [英] Some firestore quotas misunderstandings

查看:56
本文介绍了一些Firestore配额的误解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在计划Firestore中的db结构,无法理解一些标准点

I'm planning a stucture of db in firestore and cannot understand some standard points

链接: https://firebase.google.com/docs/firestore/quotas

1分

这意味着在集合中复合索引的字段的总内存大小(以db为单位)吗?

This means total memory size in db of fields which are composite indexed in collection?

3分

20000是否与文档中字段的最大数量相似,因为由于doc,每个字段都会被自动索引?或者它们的意思是

Is 20000 similar to max count of fields in document because due to doc every field is automatically indexed? or they mean something like

queryRef
   .where('field1', '<', someNumber1)
   ...
   .where('field20000', '<', someNumber20000);

对不起,我的英语不好

推荐答案

点1

您可以在存储空间计算文档中查看大小的计算方式.

Point 1

You can see how size is calculated in the Storage Size Calculation documentation.

索引条目的大小

索引条目的大小是以下各项的总和:

Index entry size

The size of an index entry is the sum of:

  • 索引文档的文档名称大小
  • 索引字段大小的总和
  • 如果已索引的文档的集合ID的大小,则 索引是自动索引(不适用于复合索引)
  • 32 其他字节
  • The document name size of the indexed document
  • The sum of the indexed field sizes
  • The size of the indexed document's collection ID if the index is an automatic index (does not apply to composite indexes)
  • 32 additional bytes

以带有数字ID的Task集合中的文档为例:

Using this document in a Task collection with a numeric ID as an example:

Task id:5730082031140864
 - "type": "Personal"
 - "done": false
 - "priority": 1

如果您的复合索引具有类型+优先级(均升序),则该索引中索引条目的总大小为84个字节:

If you have a composite index on type + priority (both ascending), the total size of the index entry in this index is 84 bytes:

  • 文档名称为29个字节
  • 6个字节表示完成的字段名称和布尔值
  • 优先级字段名称和整数值
  • 17个字节
  • 另外32个字节

对于单字段索引(我们自动创建的索引),我们为每个字段创建2个索引:升序+降序.

For single field indexes (the ones we automatically create), we create 2 indexes per field: ascending + descending.

这意味着10000个字段将达到20000索引条目的限制,因此10000个字段是当前的最大值.如果您还拥有复合索引,则更少了,因为它会消耗每个文档的20000个索引条目限制.

This means 10000 fields will hit the 20000 index entry limit, so 10000 fields is the current maximum. Less if you also have composite indexes since it will consume some of the 20000 index entry limit per document.

这篇关于一些Firestore配额的误解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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