Appengine反向引用 - 需要复合索引? [英] Appengine backreferences - need composite index?

查看:123
本文介绍了Appengine反向引用 - 需要复合索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 内建的索引效率不够高这个查询和你的数据,请为这个查询添加一个复合索引。 

我检查了引发此异常的行,并且问题查询是这样的:

  count = self.vote_set.filter(direction =,1).count()

这实际上是一个使用appengine的内置反向引用的单过滤操作。我不知道如何优化这个查询...任何人有任何建议?我试图添加这个索引:

   -  kind:Vote 
属性:
- name:direction
方向:desc

- kind:表决
属性:
- 名称:方向

我收到一条消息(显然)说这是一个不必要的索引。



感谢您的帮助。如果您在本地SDK上运行所有相关的查询,它应该生成所有需要的索引(在 index中)。

yaml ),并且建议的策略不是自己编辑 index.yaml ,而是让本地SDK为您完成。如果SDK没有生成所有需要的索引,只要您在本地测试中使用所有相关的代码路径!您应该在App Engine跟踪器这里(当然,在检查这个问题时还没有错误报告)。

b $ b

I have a query that is very recently starting to throw:

"The built-in indices are not efficient enough for this query and your data. Please add a composite index for this query."

I checked the line on which this exception is being thrown, and the problem query is this one:

count = self.vote_set.filter("direction =", 1).count()

This is literally a one-filter operation using appengine's built-in backreferences. I have no idea how to optimize this query...anyone have any suggestions? I tried to add this index:

 - kind: Vote
   properties:
   - name: direction
     direction: desc

 - kind: Vote
   properties:
   - name: direction

And I got a message (obviously) saying this was an unnecessary index.

Thanks for your help in advance.

解决方案

If you run all relevant queries on your local SDK, it should generate all needed indices (in index.yaml) and the recommended policy is not to edit index.yaml yourself but rather to let the local SDK do it for you. If the SDK is not generating all needed indices, as long of course as you do exercise all relevant code paths in your local testing!, you should open a bug for it in the App Engine tracker here (after checking that there isn't already a bug report for this problem, of course).

这篇关于Appengine反向引用 - 需要复合索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆