#29771: Support database-specific syntax for bulk_update
-------------------------------------+-------------------------------------
     Reporter:  Tom Forbes           |                    Owner:  Tom
         Type:                       |  Forbes
  Cleanup/optimization               |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (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
-------------------------------------+-------------------------------------
Changes (by Tom Forbes):

 * cc: Tom Forbes (added)


Comment:

 I think the groundwork to this is quite difficult to lay. The current
 `SQLUpdateCompiler` is not suitable for this, I think.

 Also I believe we can mimic this on SQLLite:

 {{{
 WITH test(id) AS (SELECT 1 UNION ALL SELECT 2)
 UPDATE demo
 SET name=(select id from test where id=demo.id)
 WHERE id IN (select id from test)
 }}}

 Whether or not this is faster is something I'm not sure of. I believe the
 MySQL syntax will be faster, and there is no SQL standard way of doing
 this (I believe?), so we are left with a number of pretty different
 workarounds. I'm not sure how to structure this nicely.

 I can maybe hack Postgres support into the SQLUpdateCompiler, but it's
 really not nice. We have to create all the aliases ourselves, manage the
 different column names, etc etc.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29771#comment:3>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.097e08da53d2096727e0cbd2765a793c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to