Hi

Just thought I would add this to the collective knowledge ;-)

I have the following data model

a Scene entity - holds script for a scene in a movie
                     - holds a characters reference property list

              plus some other bits.


a Character Entity

which has a method "appears_in" which fetches a list of all the scenes
the
character appears in.

which originally was doing a

result = Scene.all().filter("characters = ",self.key())

Which would return all scenes the current character was in.

I have 117 scenes (its a feature length movie)
and one character is in about 95 scenes
and the above query was getting caught out with google exceptions
saying the datastore
was taking too long.

I changed the query to use gql to see if it was any quicker

result = self.gql("where character = :1", self.key())

But ended up with the same result (takes too long)

So I added a fetch so it grabbed all the records before I started
interating of the results.

as in result=self.gql("where character = :1", self.key()).fetch()

Still got the timeout.

So I added a limit on the fetch

result=self.gql("where character = :1", self.key()).fetch(100)

Now the query performs fine (ie no timeout on the datastore).  So a
fetch with a limit appears to perform better than then same query
without the limit, even though in both cases the same number of
records are being retrieved.

I haven't checked to see if a limit of 999 makes any difference.

Just thought I would share this, it might help someone.

Rgds

Tim

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