Clarifying projection query cost?

70 views
Skip to first unread message

Alex Kerr

unread,
Apr 6, 2016, 10:12:15 AM4/6/16
to Google App Engine
Hi,

Can anyone clarify the cost of projection queries please? (both in operations and financially)

Datastore pricing page at: https://cloud.google.com/datastore/docs/pricing says a regular query (is that "SELECT * " ?) is 1 read + 1 read per entity retrieved. I get that, but then projection queries are just "1 read" - which implies a cost of 1 read total regardless of the number of results returned and the number of properties projected - that can't be right?

Also I note the new pricing section from July but still not clear on projection query cost!

Many thanks
Alex

Nick (Cloud Platform Support)

unread,
Apr 6, 2016, 7:31:22 PM4/6/16
to Google App Engine
Hi Alex,

I believe this old App Engine Groups thread answers your question adequately. Let me know if you have any questions after reading.

Cheers,

Nick
Cloud Platform Community Support 

Alex Kerr

unread,
Apr 7, 2016, 9:16:57 AM4/7/16
to Google App Engine
Thanks Nick. So can you confirm costs are:

1.) For a projection query, cost is a single read for the entire query regardless of number of results returned (and same under the new Datastore pricing)
2.) For a projection query with distinct option, cost is 1 read + 1 read per entity retrieved
3.) For normal queries ("SELECT * FROM ... " in GQL) under the new (from July) Datastore pricing, cost is 1 read per entity

Are there drawbacks to the suggestion made by the poster of that link you specified, in achieving a "SELECT * " at projection query cost, by adding in a dummy property to the entity kind and then doing a projection query on the remaining properties? (I suppose the obvious drawback being you'd need an index for every property)

Thanks,
Alex

Nick (Cloud Platform Support)

unread,
Apr 7, 2016, 4:39:57 PM4/7/16
to Google App Engine
Hey Alex,

As described in the other thread, the cost of maintaining indexes matters here, and there are other restrictions described in the documentation. I hope this helps clarify the trade-offs for you.

Regards,


Nick
Cloud Platform Community Support

Reply all
Reply to author
Forward
0 new messages