Re: [google-appengine] Re: Write Ops incurred during Model.put()
The datastore will only update indexes that changed, so if s didn't change you would only be charged 1 write op for the entity write (vs 0 write ops if you didn't call put at all). I believe the dev_appserver only shows the cost for inserting a new entity (which is substantially different from the cost of an update). On Wed, Jun 6, 2012 at 1:16 PM, mac wrote: > Hi Alfred, > > Sorry for bringing this old topic back, I am also confused by the number > showed in the dev_appserver. > > I think you meant > 1 op for the entity > 2x2 = 4 ops for each changed index value (1 remove, 1 add and two > directions) > > My question is, do we need to do checks before calling put() to make sure > it won't update all fields and their indices? > > For example, do we need to do something like below? > > s = Sample.all().get()[0] > changed = False > > if s.field1 != field1_new_value: > s.field1 = field1_new_value > changed = True > > if s.field2 != field2_new_value: > s.field2 = field2_new_value > changed = True > > if s.field3 != field3_new_value: > s.field3 = field3_new_value > changed = True > > if changed: > s.put() > > Or we can just do below. > s = Sample.all().get()[0] > s.field1 = field1_new_value > s.field2 = field2_new_value > s.field3 = field3_new_value > s.put() > > And datastore will check which fields were changed, only update those > fields and their indices? > > > On Saturday, September 24, 2011 1:00:44 PM UTC-7, Alfred Fuller wrote: >> >> Yes, the write ops for changing an entity depends on how many indexed >> properties you change. It is: >> 1 op for the entity >> 2 ops for each changed index value (1 to remove the old value and 1 to >> add the new) >> >> Since it is not a fixed value and depends on what you actually modify, we >> do not (can not) show it in the dev_appserver's Datastore Viewer. >> > -- > 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/-/aqIb5sFqOfsJ. > > 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" 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.
Re: [google-appengine] Re: Write Ops incurred during Model.put()
Hi Alfred, Sorry for bringing this old topic back, I am also confused by the number showed in the dev_appserver. I think you meant 1 op for the entity 2x2 = 4 ops for each changed index value (1 remove, 1 add and two directions) My question is, do we need to do checks before calling put() to make sure it won't update all fields and their indices? For example, do we need to do something like below? s = Sample.all().get()[0] changed = False if s.field1 != field1_new_value: s.field1 = field1_new_value changed = True if s.field2 != field2_new_value: s.field2 = field2_new_value changed = True if s.field3 != field3_new_value: s.field3 = field3_new_value changed = True if changed: s.put() Or we can just do below. s = Sample.all().get()[0] s.field1 = field1_new_value s.field2 = field2_new_value s.field3 = field3_new_value s.put() And datastore will check which fields were changed, only update those fields and their indices? On Saturday, September 24, 2011 1:00:44 PM UTC-7, Alfred Fuller wrote: > > Yes, the write ops for changing an entity depends on how many indexed > properties you change. It is: > 1 op for the entity > 2 ops for each changed index value (1 to remove the old value and 1 to add > the new) > > Since it is not a fixed value and depends on what you actually modify, we > do not (can not) show it in the dev_appserver's Datastore Viewer. > -- 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/-/aqIb5sFqOfsJ. 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.
Re: [google-appengine] Re: Write Ops incurred during Model.put()
Thanks for the definitive clarification, Alfred. It would be awesome if you guys could show the actual Read/Write Ops incurred by each URI under the Current Load section of the live dashboard. On Sat, Sep 24, 2011 at 4:00 PM, Alfred Fuller wrote: > Yes, the write ops for changing an entity depends on how many indexed > properties you change. It is: > 1 op for the entity > 2 ops for each changed index value (1 to remove the old value and 1 to add > the new) > > Since it is not a fixed value and depends on what you actually modify, we do > not (can not) show it in the dev_appserver's Datastore Viewer. > On Tue, Sep 20, 2011 at 11:09 AM, Alex Epshteyn > wrote: >> >> So the Write Ops value in the new dev_appserver's Datastore Viewer >> applies only to creating new entities of a kind, updating the entity i >> is presumably much cheaper if only a few properties are changed? >> >> On Tue, Sep 20, 2011 at 12:27 PM, Simon Knott >> wrote: >> > Hi, >> > >> > According to Alfred, who's a Googler who appears to know lots about the >> > datastore, only the updated values cause index write operations - see >> > >> > https://groups.google.com/d/msg/google-appengine/mjnSqQWOfqU/cgPVeHbrR8oJ >> > for more info. >> > >> > -- >> > 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/-/OcSq1WpF5noJ. >> > 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" 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. >> > > -- > 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. > -- 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.
Re: [google-appengine] Re: Write Ops incurred during Model.put()
Yes, the write ops for changing an entity depends on how many indexed properties you change. It is: 1 op for the entity 2 ops for each changed index value (1 to remove the old value and 1 to add the new) Since it is not a fixed value and depends on what you actually modify, we do not (can not) show it in the dev_appserver's Datastore Viewer. On Tue, Sep 20, 2011 at 11:09 AM, Alex Epshteyn < alexander.epsht...@gmail.com> wrote: > So the Write Ops value in the new dev_appserver's Datastore Viewer > applies only to creating new entities of a kind, updating the entity i > is presumably much cheaper if only a few properties are changed? > > On Tue, Sep 20, 2011 at 12:27 PM, Simon Knott > wrote: > > Hi, > > > > According to Alfred, who's a Googler who appears to know lots about the > > datastore, only the updated values cause index write operations - see > > > https://groups.google.com/d/msg/google-appengine/mjnSqQWOfqU/cgPVeHbrR8oJ > > for more info. > > > > -- > > 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/-/OcSq1WpF5noJ. > > 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" 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. > > -- 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.
Re: [google-appengine] Re: Write Ops incurred during Model.put()
So the Write Ops value in the new dev_appserver's Datastore Viewer applies only to creating new entities of a kind, updating the entity i is presumably much cheaper if only a few properties are changed? On Tue, Sep 20, 2011 at 12:27 PM, Simon Knott wrote: > Hi, > > According to Alfred, who's a Googler who appears to know lots about the > datastore, only the updated values cause index write operations - see > https://groups.google.com/d/msg/google-appengine/mjnSqQWOfqU/cgPVeHbrR8oJ > for more info. > > -- > 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/-/OcSq1WpF5noJ. > 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" 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.
[google-appengine] Re: Write Ops incurred during Model.put()
Thanks for bringing up that. Indexes updated are property changed related. I think that clears alex question. ;) FYI, if you have properties you will never filter or sort on in a query, consider *indexed=False* to avoid this write ops Best, Jose -- 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/-/Q1T6WiOEPgUJ. 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.
[google-appengine] Re: Write Ops incurred during Model.put()
Hi, According to Alfred, who's a Googler who appears to know lots about the datastore, only the updated values cause index write operations - see https://groups.google.com/d/msg/google-appengine/mjnSqQWOfqU/cgPVeHbrR8oJ for more info. -- 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/-/OcSq1WpF5noJ. 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.
[google-appengine] Re: Write Ops incurred during Model.put()
Hi, AFAIK, when you do a put() it will update the hole entity. that been said it will also update all the indexes related to it. Hope this helps! Jose Montes de Oca -- 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/-/L9blWm9jwz8J. 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.