关于 google app engine:在 appengine 数据存储上执行包含两个”包含”测试的查询需要多长时间?

How long will a query with two "contains" tests take to execute on the appengine datastore?

我有两组 30 或 40 个 ID,一组 A 和一组 B。我有一个实体,它有一个字段 idA(一个可能在集合 A 中的 id)和一个字段 idB(一个可能是在 B 组)。我想在集合 A 中找到所有具有 idA 的实体,在集合 B 中找到具有 idB 的所有实体。

我可以使用像 "A.contains(idA) 这样的过滤器来执行查询


您的列表最多只能包含 30 个项目。所以这目前不会在 App Egnine 上运行,请参阅查询过滤器部分。

The contains() operator also performs multiple queries, one for each item in the provided list value where all other filters are the same and the contains() filter is replaced with an equal-to filter. The results are merged, in the order of the items in the list. If a query has more than 1 contains() filter, the query is performed as multiple queries, one for each combination of values in the contains() filters.

A single query containing != or contains() operators is limited to 30 sub-queries.


App Engine 会将您的查询扩展到 30 * 40 = 1200 个针对 idA 和 idB 的单独组合的查询 - 或者至少,如果它不限于 30 个子查询的话。显然,这不会很有效。

替代方案取决于数据存储的结构。如果您告诉我们您想要达到的目标,我们或许可以建议不需要太多查询的替代方案。