views:

85

answers:

1

I'm wondering is there a difference in terms of computing cost for the Model.get(keys) and Model.get_by_id(ids, parent=None) methods?

Is there a server side computing advantage of using numeric id's over encoded string keys, or other way around? How big is the difference?

PS. Sorry if it's a dupe. I'm sure I read an article about it, but I cannot find it now.

+3  A: 

No. Model.get_by_id and Model.get are both simply syntactic sugar for db.get(). There's no substantial difference between passing in encoded string keys or numeric IDs, but your users may find one more friendly than the other if you're passing them around in URLs.

Nick Johnson
But IDs are not unique so it`s not good idea to rely on them, am I right?
Ilian Iliev
IDs are unique for a given entity type and parent. If you're not using parent entities, and you know the entity type from context (eg, it's a 'Page' handler, so the entity type is 'Page'), you can use just the ID.
Nick Johnson