Re: 1.5, update_fields and PostgreSQL (or other MVCC style database) - request for documentation note
2012/11/3 Christian Jensen > I was just writing some code against 1.5 and thought I might use the new > .save(update_fields=['xyz']) then I realized I was using PostgreSQL - which > is an MVCC... which re-writes the entire row as far as I know even when one > column is being updated. > > I popped into the release notes and it does in fact indicate that it is > useful for high concurrency scenarios. > > I thought it would be nice to note in the docs somewhere that it is really > not useful for database of this type unless you are using a healthy amount > of the update_fields elsewhere. > > I might be wrong on all of this. > > I have never made a documentation change nor have any idea what the > process would be so if someone chooses to make this note, please do! > > Thanks everyone! > Christian > Another important point is that you avoid unnecessary data transfer. Many times the database is on another physical server and transfer all the data from a table that has many columns, when you just need to change a few, is more expensive and has more latency. Furthermore, using "only" and "defer", avoiding additional queries are made to the database, the fields for deferred. Just save what you really have on the object. All this regardless of what the database server do internally. Andrey -- Andrey Antukh - Андрей Антух - http://www.niwi.be/about.html http://www.kaleidos.net/A5694F/ "Linux is for people who hate Windows, BSD is for people who love UNIX" "Social Engineer -> Because there is no patch for human stupidity" -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: 1.5, update_fields and PostgreSQL (or other MVCC style database) - request for documentation note
Exactly... I guess I was just asking for someone to say 'Don't use this if you think it will make the update any faster on Postgres' in the docs... in addition to what you just said :) On Fri, Nov 2, 2012 at 7:45 PM, Donald Stufft wrote: > The major help is preventing clobbering a value for concurrency. > > Prior to this when you loaded an object from SQL into a django model, it > would fetch all the values > as they were at that time, and store them in the model instance. Then when > you saved it it would > write all those values back out to the database, even if someone else had > changed them and > you didn't. > > Now if you fetch a particular instance, and make a change, you can save > only that value, and you > won't clobber other peoples saves if they made a change to an unrelated > field on that row. > > On Friday, November 2, 2012 at 9:42 PM, Christian Jensen wrote: > > I was just writing some code against 1.5 and thought I might use the new > .save(update_fields=['xyz']) then I realized I was using PostgreSQL - which > is an MVCC... which re-writes the entire row as far as I know even when one > column is being updated. > > I popped into the release notes and it does in fact indicate that it is > useful for high concurrency scenarios. > > I thought it would be nice to note in the docs somewhere that it is really > not useful for database of this type unless you are using a healthy amount > of the update_fields elsewhere. > > I might be wrong on all of this. > > I have never made a documentation change nor have any idea what the > process would be so if someone chooses to make this note, please do! > > Thanks everyone! > Christian > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-developers/-/LIGJJ2qwBZgJ. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > -- *Christian Jensen* 724 Ioco Rd Port Moody, BC V3H 2W8 +1 (778) 996-4283 christ...@jensenbox.com -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Re: 1.5, update_fields and PostgreSQL (or other MVCC style database) - request for documentation note
The major help is preventing clobbering a value for concurrency. Prior to this when you loaded an object from SQL into a django model, it would fetch all the values as they were at that time, and store them in the model instance. Then when you saved it it would write all those values back out to the database, even if someone else had changed them and you didn't. Now if you fetch a particular instance, and make a change, you can save only that value, and you won't clobber other peoples saves if they made a change to an unrelated field on that row. On Friday, November 2, 2012 at 9:42 PM, Christian Jensen wrote: > I was just writing some code against 1.5 and thought I might use the new > .save(update_fields=['xyz']) then I realized I was using PostgreSQL - which > is an MVCC... which re-writes the entire row as far as I know even when one > column is being updated. > > I popped into the release notes and it does in fact indicate that it is > useful for high concurrency scenarios. > > I thought it would be nice to note in the docs somewhere that it is really > not useful for database of this type unless you are using a healthy amount of > the update_fields elsewhere. > > I might be wrong on all of this. > > I have never made a documentation change nor have any idea what the process > would be so if someone chooses to make this note, please do! > > Thanks everyone! > Christian > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-developers/-/LIGJJ2qwBZgJ. > To post to this group, send email to django-developers@googlegroups.com > (mailto:django-developers@googlegroups.com). > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com > (mailto:django-developers+unsubscr...@googlegroups.com). > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
1.5, update_fields and PostgreSQL (or other MVCC style database) - request for documentation note
I was just writing some code against 1.5 and thought I might use the new .save(update_fields=['xyz']) then I realized I was using PostgreSQL - which is an MVCC... which re-writes the entire row as far as I know even when one column is being updated. I popped into the release notes and it does in fact indicate that it is useful for high concurrency scenarios. I thought it would be nice to note in the docs somewhere that it is really not useful for database of this type unless you are using a healthy amount of the update_fields elsewhere. I might be wrong on all of this. I have never made a documentation change nor have any idea what the process would be so if someone chooses to make this note, please do! Thanks everyone! Christian -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/LIGJJ2qwBZgJ. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.