有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Firestore中的索引是否有效?

我已经读到,每个查询都会自动创建一个索引。所以如果我创建这个查询:

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

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


共 (1) 个答案

  1. # 1 楼答案

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

    索引是为您的查询匹配的文档创建的,但您只会为您在该条件下访问的文档付费

    documentation

    An index behind every query If no index exists for a query, most databases crawl through their contents item by item, a slow process that slows down even more as the database grows. Cloud Firestore guarantees high query performance by using indexes for all queries. As a result, query performance depends on the size of the result set and not on the number of items in the database.

    Less index management, more app development Cloud Firestore includes features that reduce the amount of time you need to spend managing indexes. The indexes required for the most basic queries are automatically created for you. As you use and test your app, Cloud Firestore helps you identify and create additional indexes your app requires.