Thanks for the input Javier. Wouldn't a similar argument hold for:

UPDATE books_book

SET

 price = 10 where pk = 1,  price = 25 where pk = 2 .....

Such a single SQL statement would also have similar benefits to having much
less data to prepare, send and interpret vs having multiple update queries
being collated into a single transaction.

On 20 October 2014 11:52, Javier Guerra Giraldez <jav...@guerrag.com> wrote:

> On Mon, Oct 20, 2014 at 1:03 AM, Anshuman Aggarwal
> <anshuman.aggar...@gmail.com> wrote:
> > The idea of having a .update() ORM construct is to be able to do this
> > without having to fall down to a manual transaction every time, otherwise
> > why have a DB level <qs>.update()...I am sure the performance of above
> > pseudo code would be about the same (or sufficiently small as to be
> > ignorable)...
>
>
> i'm sure it's far from ignorable.  <qs>.update() generates an UPDATE
> ... WHERE ... statement, not specifying each record to be updated,
> just the criteria to let the DB engine choose them.  Also, the new
> field content is either a constant or specified as a function of other
> fields (when using F() objects); again, not specified individually,
> but let to the DB engine to work it out.
>
> in sum, it's a _lot_ less data to prepare, send, and interpret and
> uses a heavily optimized, totally SQL statement.  Not having it would
> be a big missing feature.
>
> --
> Javier
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-developers/Hcsh4r9_mHg/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAFkDaoQi3z62emT4Dk1hAvpM5sSUshbFSoOqumA0kZymLURO9A%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAK-d5daWgeOOBAOgTg9nWRhQnk%3DB_TvhpRTLPy2Sr-AqsiOxng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to