Hi Jai,

Both your example and my original example are cases of exploding indexes. In
my example, indexing on the same listproperty twice is required for certain
queries (for example, the Foo.all().filter('tags =', foo).filter('tags =',
bar).order('bar') example), but likewise results in an exploding index.

-Nick Johnson

On Mon, Jul 27, 2009 at 4:30 PM, Jai <[email protected]> wrote:

>
> Hi Kyle,
>
> I think what Nick meant was this:
>
> - kind: Foo
>  property: tags1
>  property: tags2
>
> that is having two different properties of type ListProperty because
> then the index will have rows for each combination of values for each
> of the property and number of rows will be multiplication of number of
> distinct values in the indexes.
>
> For your case it is ok because, there will be a single index 'tags'
> with an entity being referenced by the DIFFERENT tag values in the
> SAME index. So the references might be multiple, number of rows will
> still be linear.
>
> Hope it helps.
>
>
> Regards,
> Jai
> On Jul 27, 11:16 am, Kyle Jensen <[email protected]> wrote:
> > Hi Nick,
> >
> > I noticed that the dev server will automatically add indexes that
> > appear to be exploding indexes when I run queries like the example
> > above.  Ie, if I do Foo.get_by_tags(['tag1', 'tag2']) the dev server
> > will create an index in index.yaml that is identical to the one you
> > posted above:
> >
> > - kind: Foo
> >   property: tags
> >   property: tags
> >
> > ** Is that index not required for the snippet Foo.get_by_tags(['tag1',
> > 'tag2'])?
> > ** What about Foo.get_by_tags(['tag1', 'tag2']).order('bar') where bar
> > is an IntegerProperty
> >
> > Thanks for your help and sorry for my ignorance!!
> > Kyle
> >
> > On Jul 27, 8:07 am, "Nick Johnson (Google)" <[email protected]>
> > wrote:
> >
> > > Hi Kyle,
> >
> > > Exploding indexes only come into play when you're _defining_ indexes -
> for
> > > example, an index like this would be an exploding one:
> >
> > > - kind: Foo
> > >   property: tags
> > >   property: tags
> >
> > > As long as you can satisfy your queries using the built in merge join
> > > support (which is the case in your example, where you don't specify
> > > inequality filters or sort orders), you'll be fine.
> >
> > > -Nick Johnson
> >
> > > On Mon, Jul 27, 2009 at 3:50 PM, Kyle Jensen <[email protected]>
> wrote:
> >
> > > > Hi, I'd like to know if multiple equality filters on a ListProperty
> > > > leads to exploding indexes.
> >
> > > > I have a model something like the following (python):
> >
> > > > class Foo(db.model):
> > > >    tags = db.ListProperty(db.Category)
> >
> > > >    @classmethod
> > > >    def get_by_tags(cls, tags):
> > > >        query = cls.all()
> > > >        for tag in tags:
> > > >            query.filter('tags =', tag)
> > > >        return query
> >
> > > > I'd like to know if I can filter by an arbitrary number of tags
> > > > without encountering the exploding index problem (its not clear to me
> > > > from the docs).
> >
> > > > E.g., can I do
> > > > query = Foo.get_by_tags(['tag0', 'tag1', 'tag2', 'tag3' .... 'tagN'])
> >
> > > > etc etc.
> >
> > > > Thanks! Kyle
> >
> > > --
> > > Nick Johnson, Developer Programs Engineer, App Engine
> >
> >
>
> >
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine

--~--~---------~--~----~------------~-------~--~----~
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