与获取查询相比,仅键查询的成本(谷歌应用程序引擎) [英] Cost of keys-only query compared to get query (google app engine)

查看:123
本文介绍了与获取查询相比,仅键查询的成本(谷歌应用程序引擎)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在研究Google应用程序引擎中的数据存储区调用的成本(包括定价和时间)。我只是简单地询问一个关键字查询和一个查询。



如果我唯一的担心是检查一个实体是否存在,我可以在有两种方法:使用get和检查异常,或使用仅键查询并检查结果的大小。如果我要正确理解这一点,那么只有键的查询是免费的,而获取查询将会花费。因此,从削减定价角度来看,更有意义的是使用只有键的查询,而不是查询来检查实体是否存在。我是否正确?

如果是这样,那么时间成本是否会产生很大的差异?我知道获取查询比普通查询更快,但我不确定如何比较仅用于键的查询的性能。如果它可以忽略不计,那么我应该坚持只有键的查询。



谢谢。

解决方案

你只会收到钥匙,而不是你只能通过钥匙查询。



所以是的,如果它适合你的目的,那可以是免费的。



https: //developers.google.com/appengine/docs/python/datastore/queries#Python_Keys_only_queries


I've been reading into the cost of datastore calls in the google app engine lately (both in terms of pricing and time). I just have a quick question about a keys-only query vs a get query.

If my only concern was to check if an entity exists, I could go about it in two ways: use get and check for an exception, or use a keys-only query and check for the size of the result. If I am to understand this correctly, keys-only queries are free while a get query will cost. Therefore, it would make more sense in terms of cutting back on the pricing, to use keys-only queries rather than get queries to check if an entity exists. Am I correct?

If so, would the time cost make much of a difference? I know that get queries are faster than normal queries, but I am not sure how the performance compare for keys-only queries. If it is negligible, then I should stick with keys-only queries.

Thank you.

解决方案

A keys-only query means that you'll receive back only the keys, not that you're querying only by the keys.

So yes, that could be OK and free if it fits your purposes.

https://developers.google.com/appengine/docs/python/datastore/queries#Python_Keys_only_queries

这篇关于与获取查询相比,仅键查询的成本(谷歌应用程序引擎)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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