There are limitations to what you can do with projection queries (see Limitations on projections <https://cloud.google.com/appengine/docs/python/ndb/projectionqueries#Python_Limitations_on_projections>). Notably, all properties in a projection query require an index which can incur other costs such as increased number of write ops. This also means you cannot include long byte strings or text strings in a projection.
With that being said, projection queries require a far fewer number of read ops compared to normal queries and are good to use when it makes sense to do so. On a specific test I've seen around 0.03 million ops for a batch of regular queries where the same number of projection queries is too small to register in the console, so a 1:100 difference sounds about right. On Thursday, February 4, 2016 at 6:36:39 PM UTC-5, Susan Lin wrote: > > I would like to confirm the cost of a projection query. According to > https://cloud.google.com/appengine/pricing the cost of a project query is > 1 read operation while a a normal query getting the whole entity is 1 read > + 1 read per entity retrieved. > > If I have entities in this structure: > > MyEntity > -ID > -Name > -Birthday > > If I select do a projection query to get retrieve the ID and Name of > everyone who's birthday is greater than a some date lets say Jan 1st 2000. > If there are 100 entities which match does the return only count as 1 read > to get all 100 entities back? If this is the case then say I also want to > retrieve the birthday property, but don't wan't to select all the > properties to avoid a query which gets the whole entity then why not then > add a dummy property that has no use to the entities so then you can still > select all the properties I need (ID,Name, and Birthday) and still only use > 1 read operation. > > If I did a query to select all the properties of a user who's birthday is > greater than a some date lets say Jan 1st 2000. If there are 100 entities > which match does the return will costs be 1 + 100 read operations? > > Cheers > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/40e52cb0-8ab2-492c-bc08-d4c2c966e99f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
