Posting this Django Project ticket that I opened to track the enhancement request to update multiple rows with different values for the same field for a particular Django queryset in a single SQL query without having to write raw SQL. Please see the discussion there.
https://code.djangoproject.com/ticket/23646 I disagree with Russel that there will not be a performance impact. Firing 1000s of SQL queries to update single rows will lead to locking of the table in Postgres atleast, not to mention the overheads of individual SQL queries, transactions etc. If the database support natively updating multiple values then it can be done that way. A possible SQL solution is outlined in the link (below) but it should ideally be supported via the Django Manager and not via a Raw SQL which becomes much harder to maintain. http://stackoverflow.com/questions/18797608/update-multiple-rows-in-same-query-using-postgresql If agreed, I would look to contributing a patch if we can finalize the API for the same here. Thanks, Anshuman -- 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 [email protected]. To post to this group, send email to [email protected]. 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/c650999b-7a0d-49e8-aa0d-84e789b2f833%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
