I have an entity Kind A
with around 1.3 million entities. It has several fields, two of which I use as filters in a Datastore query - K
(which is a Key) and S
(which is a string).
I perform the following query, and it takes it almost 8 seconds to complete:
SELECT * FROM A WHERE K=KEY('...') AND S='...' LIMIT 1
(I do this by constructing a query with filters in java, but it works just as slow in GQL.)
Is this reasonable? Can this be improved in any way?
Replacing the key query with other fields (or removing completely), speeds things up. Does it make sense to save the key field as a string, and query on that instead of on the original Key type field?
id
orname
? A key is much longer. – Andrei Volgin