#31202: Bulk update suffers from poor performance with large numbers of models 
and
columns
-------------------------------------+-------------------------------------
     Reporter:  Tom Forbes           |                    Owner:  Tom
         Type:                       |  Forbes
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Hannes Ljungberg):

 One suggestion is to use the `UPDATE..FROM`-syntax along with `VALUES` on
 backends which supports it. For example:

 {{{
 UPDATE mytable
 SET
   mytext = myvalues.mytext,
   myint = myvalues.myint
 FROM (
   VALUES
     (1, 'textA', 99),
     (2, 'textB', 88),
 ) AS myvalues (pk, mytext, myint)
 WHERE mytable.pk = myvalues.pk
 }}}

 I know PostgreSQL supports this syntax but I haven't looked into the
 others.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31202#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.1de51a75a28a10db9970b47b87e02bf5%40djangoproject.com.

Reply via email to