Hi Nick, Thank you for your response. That was exactly what I wanted to know. AppStats looks pretty neat and I will try to use that.
Shinichi On Thu, Mar 18, 2010 at 09:29, Nick Johnson (Google) <[email protected]> wrote: > Hi Shinichi, > Referenced entities are cached against the entity that's doing the > referencing - so if you have multiple entities referencing the same entity, > it'll be fetched multiple times. You can work around this by passing it in, > as you suggest, or by using a prefetch recipe such as this > one: http://blog.notdot.net/2010/01/ReferenceProperty-prefetching-in-App-Engine > In general, Guido's appstats is an excellent tool for diagnosing these sort > of things: https://sites.google.com/site/appengineappstats/ > -Nick Johnson > > On Tue, Mar 16, 2010 at 7:39 AM, Shinichi Nakanishi <[email protected]> > wrote: >> >> Does datastore run query for Instructor each time? Or does it some >> sort of cache thing? >> >> If I have these models: >> >> class Instructor(db.Model) >> firstName = db.StringProperty() >> lastName = db.StringProperty() >> >> class Participant(db.Model) >> firstName = db.StringProperty() >> lastName = db.StringProperty() >> workshop = db.ReferenceProperty(Workshop, collection_name = >> "participants") >> >> class Workshop(db.Model) >> instructor = db.ReferenceProperty(Instructor) >> >> Then if I do the following, >> >> workshop = Workshop.all().get() >> for participant in workshop.participants: >> someMethod(workshop, participant) >> >> def someMethod(self, workshop, participant) >> if (workshop.instructor... # does it run query every time or does it >> cache? >> >> If datastore queries Instructor every time when I do >> workshop.instructor, I thought I should pass instructor as an >> argument. >> >> Shinichi >> >> -- >> 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. >> > > > > -- > Nick Johnson, Developer Programs Engineer, App Engine > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > 368047 > > -- > 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.
