If you look at how indexes work in AppEngine, this probably does not make much sense unless the index is specifically constructed. Fields capable of being quieted with anyvalue would need to be at the end and in a certain order. So you are probably not going to gain that much.
Each (indexed) property already has an individual index on it, so in your example you should just query on isThisMonth anyway. You will probably not notice much of a hit at write time from 4 or 5 composite indexes. But, those indexes will speed your queries up a lot. I suggested seeing the next gen query talk because he discusses some coming features that will reduce the need for indexes in some cases like yours. Robert On Jul 20, 2010, at 23:07, Tapir <[email protected]> wrote: > As I mentioned at the end of my first comment. > The sql includes the 3 fields :isToday, isThisWeek and isThisMonth" is > to create less indexes. > If I use the 3 fields each in a sql, then there will be 3 indexes > created insead of one. > > I heard of that more indexes means more index builing time when create > or update an entity. > > I also know the query with sql "(isToday==true || isToday==false) && > (isThisWeek==true || > isThisWeek==false) && isThisMonth==true" in fact is 4 sub queries. > It is not efficient. > > But if there is a AnyValue filter, the query with sql " AnyValue > (isToday) && AnyValue(isThisWeek) && isThisMonth==true" > is exactly one sub query. > > There are more cases, with a AnyValue filter, ther number of indexes > will largely saved. > > > On Jul 15, 4:09 am, Robert Kluin <[email protected]> wrote: >> Hi Tapir, >> You might want to read the "How Entities and Indexes are Stored" >> article from the "Mastering the Datastore" series. >> http://code.google.com/appengine/articles/datastore/overview.html >> >> You might also check out Alfred Fullers next gen queries talk from >> Google IO 2010. >> http://code.google.com/events/io/2010/sessions/next-gen-queries-appen... >> >> Robert >> >> >> >> On Tue, Jul 13, 2010 at 10:12 PM, Tapir <[email protected]> wrote: >>> For example, this query: >> >>> (isToday==true || isToday==false) && (isThisWeek==true || >>> isThisWeek==false) >>> && isThisMonth==true >> >>> in fact contains 4 sub queries: >> >>> (isToday==true) && (isThisWeek==true) && isThisMonth==true >>> (isToday==true) && (isThisWeek==false) && isThisMonth==true >>> (isToday==false) && (isThisWeek==true) && isThisMonth==true >>> (isToday==false) && (isThisWeek==false) && isThisMonth==true >> >>> If use the AnyValue filter, only one sub query is needed: >> >>> AnyValue (isToday) && AnyValue(isThisWeek) && isThisMonth==true >> >>> BTW, the reason of using one query instead of 4 queries is to decrease >>> the number of indexes. >> >>> -- >>> 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 >>> athttp://groups.google.com/group/google-appengine?hl=en.- Hide quoted text - >> >> - Show quoted text - > > -- > 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. > -- 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.
