single-property GQL causes unexpected composite index
-
11-06-2021 - |
Question
If I execute this GQL query:
GQLQuery("SELECT user FROM MyUser WHERE foo = :1", fooz)
It will cause my index.yaml to make a composite index with both the user
and foo
properties.
- kind: MyUser
properties:
- name: user
- name: foo
And if i delete that index, when it's uploaded to App Engine and my app runs, an error appears
no matching index found
.
I just don't understand why GAE must create a composite index for that query??
Solution
This behaviour is fully documented here:
Projection queries require all properties specified in the projection to be included in a datastore index.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow