[google-appengine] Re: key name (String) vs key id (long) performance
On Thu, Jun 11, 2009 at 4:52 PM, cryb wrote: > Hi Rodrigo.. Indeed, what you said is correct... however, bigtable > internals can use different optimizations/lookup algorithms/key > structure representation for different key types like key ids and key > names (even if their logical structure appears to be identical)... > Please note that I don't say it does, but I just want to make sure > that both kind of keys behave the same in therms of lookup > performance. Hi cryb, Someone asked this a while ago on irc. There's no difference. All get(key) have in theory the same lookup cost. Meaning that get_by_key_name() and get_by_id() have the same performance. -- rodrigo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: key name (String) vs key id (long) performance
Hi Rodrigo.. Indeed, what you said is correct... however, bigtable internals can use different optimizations/lookup algorithms/key structure representation for different key types like key ids and key names (even if their logical structure appears to be identical)... Please note that I don't say it does, but I just want to make sure that both kind of keys behave the same in therms of lookup performance. On Jun 11, 8:57 pm, Rodrigo Moraes wrote: > On Thu, Jun 11, 2009 at 2:19 PM, cryb wrote: > > Is there an official position / benchmark about what type of keys > > issue the best performance as for queries? > > Are key ids (long) being looked up faster than key names (string) - > > assuming that both have comparable sizes in bytes? > > There's no difference. Both key_name's and id's are used internally to > build a Key from path, which is then used to get the entity. So, when > you do Model.get_by_id(1) or Model.get_by_key_name('a'), you're > actually doing Model.get(Key.from_path('Model', 1)) or > Model.get(Key.from_path('Model', 'a')) - essentially the same thing. > > -- rodrigo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: key name (String) vs key id (long) performance
On Thu, Jun 11, 2009 at 2:19 PM, cryb wrote: > Is there an official position / benchmark about what type of keys > issue the best performance as for queries? > Are key ids (long) being looked up faster than key names (string) - > assuming that both have comparable sizes in bytes? There's no difference. Both key_name's and id's are used internally to build a Key from path, which is then used to get the entity. So, when you do Model.get_by_id(1) or Model.get_by_key_name('a'), you're actually doing Model.get(Key.from_path('Model', 1)) or Model.get(Key.from_path('Model', 'a')) - essentially the same thing. -- rodrigo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---