distinct on 子句在云数据存储中意味着什么?它如何影响读取?
What does the distinct on clause mean in cloud datastore and how does it effect the reads?
cloud datastore doc 是这么说的,但我很难理解这到底是什么意思:
A projection query that does not use the distinct on
clause is a small operation and counts as only a single entity read for the query itself.
Grouping
Projection queries can use the distinct on
clause to ensure that only the first result for each distinct combination of values for the specified properties will be returned. This will return only the first result for entities which have the same values for the properties that are being projected.
假设我有一个 table 问题,我只想按创建日期对问题文本进行排序,这会算作一次读取并作为小操作休息吗?
如果您的目标只是投影日期和文本字段,您可以在这两个字段上创建复合索引。当您查询时,这是一个小操作,所有结果都作为一次读取。在这种情况下,您并没有尝试去重(因此没有 distinct/on),因此这是一次读取的小操作。
cloud datastore doc 是这么说的,但我很难理解这到底是什么意思:
A projection query that does not use the
distinct on
clause is a small operation and counts as only a single entity read for the query itself.Grouping
Projection queries can use the
distinct on
clause to ensure that only the first result for each distinct combination of values for the specified properties will be returned. This will return only the first result for entities which have the same values for the properties that are being projected.
假设我有一个 table 问题,我只想按创建日期对问题文本进行排序,这会算作一次读取并作为小操作休息吗?
如果您的目标只是投影日期和文本字段,您可以在这两个字段上创建复合索引。当您查询时,这是一个小操作,所有结果都作为一次读取。在这种情况下,您并没有尝试去重(因此没有 distinct/on),因此这是一次读取的小操作。