简体   繁体   English

Google App Engine(Python)祖先查询缓慢

[英]Google App Engine (Python) slow ancestor queries

I am using appstats to debug some important queries in our app. 我正在使用appstats调试应用程序中的一些重要查询。 One thing I noticed is that for a particular entity kind, an ancestor query is many times slower than a non-ancestor query. 我注意到的一件事是,对于特定的实体类型,祖先查询的速度比非祖先查询的速度慢许多倍。

When I go from: 当我从:

q = Entity.query(ancestor=ancestor_key)
q = q.filter(Entity.field == 'foo')
return q.fetch(10)

to: 至:

q = Entity.query()
q = q.filter(Entity.field == 'foo')
return q.fetch(10)

In the development environment, the first query always takes more than 500 ms and often above 1 second while the second one takes 20-100 ms. 在开发环境中,第一个查询通常要花费500毫秒以上,通常要超过1秒钟,而第二个查询则需要20-100毫秒。 All the right indexes are in place and nothing else is running at the same time as the queries. 所有正确的索引均已就绪,并且没有其他查询与查询同时运行。

Any ideas? 有任何想法吗?

The dev_appserver is an emulation of the real thing. dev_appserver是对真实事物的仿真。 It can't behave in the same way. 它不能以相同的方式表现。 Don't worry about stuff like this unless it's also a problem when deployed. 除非部署时也有问题,否则不必担心这种事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM