gpt4 book ai didi

java - Firestore 中的索引是否有效?

转载 作者:行者123 更新时间:2023-12-02 08:46:20 25 4
gpt4 key购买 nike

我读到,对于每个查询,都会自动创建一个索引。因此,如果我创建此查询:

db.collection("users").whereEqualTo("admin", true);

我得到一个结果,是否为 admin 属性创建了索引?如果是,这会占用文档配额空间吗?

最佳答案

查询不占用文档空间。文档的空间位于您的用户集合下方的文档本身中;每个文档都有自己的大小,并且这个大小不会受到每个字段的索引的影响

索引是为您的查询匹配的文档创建的,但您只需为仅根据该条件访问的文档付费。

来自documentation :

An index behind every query If no index exists for a query, mostdatabases crawl through their contents item by item, a slow processthat slows down even more as the database grows. Cloud Firestoreguarantees high query performance by using indexes for all queries. Asa result, query performance depends on the size of the result set andnot on the number of items in the database.

Less index management, more app development Cloud Firestore includesfeatures that reduce the amount of time you need to spend managingindexes. The indexes required for the most basic queries areautomatically created for you. As you use and test your app, CloudFirestore helps you identify and create additional indexes your apprequires.

关于java - Firestore 中的索引是否有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61058997/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com