On Apr 21, 2:10 pm, Nick Johnson <[email protected]> wrote:
> Hi Amir,
>
> The amount of storage used depends hugely on what indexes you define.
> In particular, there is the problem of 'exploding indexes'. Suppose
> you have an entity with the following properties:

My models are of this form:

class A(db.Model):
    a1 = db.IntegerProperty()
    a2 = db.IntegerProperty()

class B(db.Model):
    b1 = db.StringProperty()
    b2 = db.IntegerProperty()
    b3 = db.IntegerProperty()
    b4 = db.TextProperty()

I have a composite index of this form:

- kind: B
  properties:
  - name: b1
  - name: b2

There are no parent relationships.

Amir



>
> foo.alist = [1, 2, 3, 4, 5]
> foo.anotherlist = ["foo", "bar", "baz", "quux"]
> foo.anumber = 42
>
> And suppose that foo is a child entity of another entity called "bar",
> which is itself a child entity of "bleh".
>
> Creating an index on 'anumber' will insert exactly one index entry, as
> you would expect.
> Creating an index on 'alist' or 'anotherlist' will insert 5 and 4
> index entries - one for each item in the list.
> Creating an ancestor index on 'anumber' will insert 3 entries - one
> for (foo, 42), one for (bar, 42), its parent, and one for (bleh, 42),
> the root entity.
>
> If you start combining properties with multiple values, though, things
> start to become problematic:
> An index on 'alist' and 'anotherlist' will create 5*4=20 index entries.
> An ancestor index on 'alist' and 'anotherlist' will create 5*4*3=60
> index entries!
> An index on 'alist', 'alist' (eg, the same entry twice to allow
> selecting only entities that have two different values for the list)
> will create 5*5=25 index entries.
>
> As you can see, this becomes particularly problematic with long lists,
> and indexes that index more than one of them, or the same one twice. I
> would hazard a guess that you either suffer from 'exploding indexes',
> or simply have a lot of indexes over your entities.
>
> -Nick Johnson
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to