Reading the documentation on Cloud Datastore, it's pretty clear that a Get retrieves the entire entity, and that a query is always done against the index.
Here's where it gets confusing, because according to the documentation:
Projection queries allow you to query Cloud Datastore for just those
specific properties of an entity that you actually need, at lower
latency and cost than retrieving the entire entity
But if all queries are done against an index, a query would never retrieve the entire entity anyway as everything is taken from the index? If I have an index with 3 properties (A, B and C) there shouldn't be any difference in using a regular query or a projection query, because I can't "project" just A and B, as the index also contains C, so in this example I would have to "project" the same properties as the regular query?
It seems to me that projection queries can only really be used when an index doesn't contain all the properties on an entity? So if an entity doesn't have a lot of properties, it doesn't make any sense to use projection because most (if not all) queries will be using/getting all the properties anyway? I'm wondering if makes sense cost-wise to use projection in this case, because the documentation says that projection has lower latency and cost
but would that apply to projection when grabbing all properties?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…