在 Cloud Firestore Android 代码实验室中跟进有关性能的信息

Follow up on the Cloud Firestore Android codelab about performance

做完 codelab 我有几个问题。

restaurants 集合下可以存储多少 document 并且仍然 保持快速过滤搜索响应?更具体地说,例如,如果更改了代码实验室,那么搜索餐馆而不是搜索并过滤我们银河系中的恒星。我知道 Cloud Firestore 是实时的,但如果该集合包含 10 亿颗恒星并过滤诸如大小、位置和光谱类型之类的东西怎么办。

是否应该选择另一种方法来收集星星?

您描述的情况实际上就是 Cloud Firestore 的用途。来自 announcement blog post:

Queries scale with the size of your result set, not the size of your data set, so you'll get the same performance fetching 1 result from a set of 100, or 100,000,000.

Cloud Datastore has this property, too. Our documentation on structuring data in Cloud Firestore 也可能有帮助。