2
votes

I have read in various places that:

projection queries run faster and cost less than one that returns complete entities

because the query results are satisfied from the indexes rather than disk reads. See:Google docs here and Comment from Guido Van Rossum here.

The comments from Guido seem to imply that it is faster to retrieve an entity's details through a projection query than through a key.

However, Pg 135 of 'Programming GAE with Python' by Dan Sanderson mentions:

if you have a key...you can retrieve the entity quickly, much more quickly than with a datastore query.

Given a situation where i can retrieve my data using either a projection query or the entities' key (with get_multi):

  1. Is it faster to use the keys or the projection queries?
  2. Is one method more expensive than the other?
1
From Guido answer from the part "in terms of fewer I/O operations) " I can understand that they are the same. With an exception of bandwidth as he said. About your second question you can check the bullets from the pricing doc.alcohealism

1 Answers

0
votes

The advise is consistent. I'll try to clarify.

  1. If you have a key, fetch an entity with that
  2. If you don't have a key AND you can solve you problem with a projection, use that
  3. If you don't have a key, need full entity(s), then use a query that returns full entities