I'm running this query (.toString()) in my Java code:
SELECT * FROM FactWeekMediumKeyword WHERE __key__ >=
DimAccount("d0012000000RlItfAAF")/FactWeekMediumKeyword("O27kBI-kCV==
JqKWRaCc73KiOq_iOF== ") AND __key__ <
DimAccount("d0012000000RlItfAAF")/FactWeekMediumKeyword("O27kBI-kCV==
JqKWRaCc73KiOq_iOV== ") AND __ancestor__ is
DimAccount("d0012000000RlItfAAF") ORDER BY __key__
which is equalivalent to this GQL query for the Datastore Viewer in
the appengine website:
SELECT * FROM FactWeekMediumKeyword WHERE __key__ >=
Key('DimAccount','d0012000000RlItfAAF', 'FactWeekMediumKeyword',
'O27kBI-kCV== JqKWRaCc73KiOq_iOF== ') AND __key__ <
Key('DimAccount','d0012000000RlItfAAF',
'FactWeekMediumKeyword','O27kBI-kCV== JqKWRaCc73KiOq_iOV== ') AND
ancestor is Key('DimAccount', 'd0012000000RlItfAAF') ORDER BY __key__
This query (and my production code) return 23 records. If I remove
the "ancestor is" part and query:
SELECT * FROM FactWeekMediumKeyword WHERE __key__ >=
Key('DimAccount','d0012000000RlItfAAF', 'FactWeekMediumKeyword',
'O27kBI-kCV== JqKWRaCc73KiOq_iOF== ') AND __key__ <
Key('DimAccount','d0012000000RlItfAAF',
'FactWeekMediumKeyword','O27kBI-kCV== JqKWRaCc73KiOq_iOV== ') ORDER BY
__key__
I get what I want, all 49 records.
Looking at two records as an example,
name=O27kBI-kCV== JqKWRaCc73KiOq_iOF==
NMKoQqpWS5KZ75OjRaKs76GmNLGdQaR=
which is returned in both queries, and
name=O27kBI-kCV== JqKWRaCc73KiOq_iOF== Nb8jPqKm75OjRaKs76GmNLGdQaR=
which is returned only in the 49 result query, there is something
wrong with the ancestor I believe.
The keys (and internal entity keys) are:
DimAccount: name=d0012000000RlItfAAF > FactWeekMediumKeyword:
name=O27kBI-kCV== JqKWRaCc73KiOq_iOF==
NMKoQqpWS5KZ75OjRaKs76GmNLGdQaR=
entity key prefix:
ag1idHNlYXJjaHNtYXJ0cnwLEgpEaW1BY2NvdW50IhNkMDAxMjAwMDAwMF
DimAccount: name=d0012000000RlItfAAF > FactWeekMediumKeyword:
name=O27kBI-kCV== JqKWRaCc73KiOq_iOF==
NMKoQqpWS5KZ75OjRaKs76GmNLGdQaR=
entity key prefix:
ag1idHNlYXJjaHNtYXJ0coABCxIKRGltQWNjb3VudCITZDAwMTIwMDAwMD
The second entity key prefix, I imagine, should match the first since
they have the same ancestor.
Two questions:
1) If I query on a range of keys, is there any performance gain by
filtering on the ancestor as well?
2) Can you confirm that this is some internal Datastore bug?
Last bit of information, I believe this bug started when I created
new __key__ indexes, which I didn't think I needed, but they get
generated anyways from the auto-generate-indexes code.
Thanks,
Clay
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.