Janusz Skonieczny
Janusz Skonieczny

Reputation: 19040

What's faster Model.get(keys) or Model.get_by_id(ids, parent=None)

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.

Upvotes: 1

Views: 415

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

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.

Upvotes: 4

Related Questions