Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient Query Strategy: keys only query + memcache in appengine?

I currently cache all my entities in my appengine datastore by key in memcache.

Is it more efficient for me to do all my queries as KEY ONLY queries and then getting the actual entities from memcache? Obviously doing a batch get on entities that are missing from cache. In general is that more efficient that doing a simple query from the datastore that returns the entire entity.

like image 999
aloo Avatar asked Dec 27 '22 14:12

aloo


1 Answers

Doing this may be marginally cheaper, but since you'll probably have to fetch at least one entity that was missing from memcache, you won't save much time with this approach. A much better solution is to store the result of a query in memcache, so you can fetch the result set with a single memcache get.

like image 84
Nick Johnson Avatar answered Jan 17 '23 18:01

Nick Johnson