Reputation: 1
According to this documentation Here
If I use projection queries with all properties in entity.It will cost me 1 entity read for query and small operation for results.
Is it better than I get all key with key-only queries then get entity data with get(key)? It will cost me 1 entity read for query and N times entity read for entity data.
Thank you.
Upvotes: 0
Views: 358
Reputation: 1148
Note that while projecting will result in a single read op, you need to have all the fields you want to project to be present in the index. An additional index has storage cost and also potentially increase the write latency. So, if you are projecting just a couple of fields of small size, then you can create such a composite index and do a projection and it will only cost one operation.
If composite index with projection is not an option, then you can still try to resolve as much of your where clause as possible via the index and at that point a single query that fetches all the entities will only cost N and (not 1+N where you first get keys and then the entities).
Upvotes: 0