I should point out the SDK is currently very insistent about it's
"suggestions" and believes that everything else is wrong (will throw
an NeedIndexError),
even though it may not be. We are working making the SDK smarter in this
regards, but until then you will have to test in production (you can test in
production now). Here is a short blurb about how you can remove exploding
indexes (official docs coming soon):

Consider:

SELECT * FROM Model WHERE list1 = :1 AND list2 =:2 AND ancestor is :3 AND
int = :4 ORDER BY date DESC

Which 'needs' this index (from the perspective of the SDK):
- kind: Model
  ancestor: yes
  properties:
  - name: list1
  - name: list2
  - name: int
  - name: date
    direction: desc

Here a easy way to figure out what non-exploding indexes can be used
instead:

   1. Group all properties with equality/ancestor filters
      1. in this case [ancestor, list1, list2, int]
   2. Split this grouping such that no multi-valued properties are in the
   same group
      1. one example is: [ancestor, list1], [list2, int], but the
      most efficient split actually repeats the single value properties:
      [ancestor, list1, int], [ancestor, list2, int]
   3. Create the following indexes

    For each group:
        add index([grouped values] + [query orders/inequality])

    in this case:
        index(ancestor, list1, int, -date)
        index(ancestor, list2, int, -date)

    or

- kind: Model
  ancestor: yes
  properties:
  - name: list1
  - name: int
  - name: date
    direction: desc
- kind: Model
  ancestor: yes
  properties:
  - name: list2
  - name: int
  - name: date
    direction: desc

 - Alfred

On Tue, Jul 12, 2011 at 4:34 PM, Alfred Fuller <
arfuller+appeng...@google.com> wrote:

> Hi,
>
> It means that there are alternatives to using exploding indexes (i.e. they
> are no longer required to execute a given query). You can still have them
> (there are cases where they are useful, namely to optimize query speed over
> write cost) and the SDK will still suggest them in many cases (as it is hard
> to detect them by looking at the query). However, the SDK will no long
> suggest indexes with the same property repeated multiple times (as these are
> obviously an exploding index).
>
> One example where this is very important is 
> SearchableModel<http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/ext/search/__init__.py>,
> which previously was crippled by exploding indexes if you tried to sort
> results (and now works as expected).
>
> We are working on an article that goes through how to decided when to
> remove or keep them, but for now the Google IO talk from 2010, Next Gen
> Queries<http://www.google.com/events/io/2010/sessions/next-gen-queries-appengine.html>
>  (The
> "Zigzag Merge Join += Sort" part), is a good resource if you want a really
> deep dive on how this works.
>
>  - Alfred
>
> On Tue, Jul 12, 2011 at 2:24 AM, Pascal Voitot Dev <
> pascal.voitot....@gmail.com> wrote:
>
>> exactly the same question ;)
>>
>> On Tue, Jul 12, 2011 at 11:21 AM, Max <thebb...@gmail.com> wrote:
>>
>>> Great job!
>>>
>>> May I know more about *t**he datastore now never requires an exploding
>>> index*?
>>>
>>> Does that mean we don't need to build exploding index or simply can't
>>> build exploding index?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google App Engine" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/google-appengine/-/KyL9f70-VtkJ.
>>>
>>> To post to this group, send email to google-appengine@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-appengine+unsubscr...@googlegroups.com.
>>> 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 for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?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 google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to