That link - /_ah/stats/shell - does not seem to be working for me on either the dev server or the live server. I get a 404 error.
I think I found the issue - the query that is confusing me is using an 'IN' filter, eg property IN [1,2] In this case, for a keys-only query, would each member of the 'IN' count as a full read? If I did IN[1,2,3,4,5,6,7,8,9,10] and the query returned no results, would this use 10 read ops? On Friday, January 4, 2013 11:50:44 PM UTC+2, Johan Euphrosine (Google) wrote: > > Hi Ryan, > > A query cost 1 read + 1 read per entity retrieved or 1 small read per key > if that's a key only query as described in the documentation: > > https://developers.google.com/appengine/docs/billing#Billable_Resource_Unit_Costs > > So fetching 2 items using a regular query should cost: > 1 DATASTORE_READ (query) + 2 DATASTORE_READ (entity read) > > Fetching 2 items using a key only query then a get_multi should cost: > 1 DATASTORE_READ (query) + 2 DATASTORE_SMALL (key read) + 2 DATASTORE_READ > (entity read) > > Fetching 2 items using a key only query then getting them from the cache > should cost: > 1 DATASTORE_READ (query) + 2 DATASTORE_SMALL (key read) > > I would recommend to experiment with the new AppStats shell > (/_ah/stats/shell on your appstats enabled app) to figure out query cost, > for example this query: > q = User.query(User.data == 'foo') > results in the following appstats trace if there is only 3 entities with > data == 'foo': > @164ms datastore_v3.RunQuery real=10ms api=0ms cost=280 > billed_ops=[DATASTORE_READ:4] > > Here is slidedeck explaining some optimization pattern for datastore > operations using interactive appstats examples (click the Run button on > each slide). > http://proppy-appstats.appspot.com/#2 > > Hope that helps, and let me know if you experience anything different. > > > On Fri, Jan 4, 2013 at 1:12 PM, Ryan Chazen <[email protected]<javascript:> > > wrote: > >> Hi, >> >> Could anybody help me out with understand keys-only query costs? >> >> I've done the following tests: >> >> Fetch 2 items using a regular query (fully entity fetched) >> - (3 RPCs, cost=350, billed_ops=[DATASTORE_READ:5]) >> Fetch 2 items using a keys-only query, and then fetch the full item >> (cache miss) >> - (9 RPCs, cost=370, billed_ops=[DATASTORE_READ:5, DATASTORE_SMALL:2]) >> Fetch 2 items using a keys-only query, and fetch the full entity from >> memcache (cache hit) >> - (5 RPCs, cost=230, billed_ops=[DATASTORE_READ:3, DATASTORE_SMALL:2]) >> >> So even with full cache hit, a keys-only query still uses 3 full >> datastore reads? >> I'm assuming keys-only queries should only be used when the hit chance is >> high? eg only use keys-only queries on data that is expected to have been >> accessed recently. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-appengine/-/O7xPE09_GIwJ. >> To post to this group, send email to >> [email protected]<javascript:> >> . >> To unsubscribe from this group, send email to >> [email protected] <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine?hl=en. >> > > > > -- > Johan Euphrosine (proppy) > Developer Programs Engineer > Google Developer Relations > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/THMnRkHcFwIJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
