#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 Simon Charette):
Just to make it clear, this ticket is specifically about `bulk_update`
poor performance which neither related managers `add` or `remove` methods
make use of.
In the case of `group.users.add`, assuming no `m2m_changed`
[https://docs.djangoproject.com/en/5.1/ref/signals/#m2m-changed signal is
connected], it should result in
[https://github.com/django/django/blob/89e28e13ecbf9fbcf235e16d453c08bbf2271244/django/db/models/fields/related_descriptors.py#L1469-L1480
a single] `bulk_create` call which effectively suffers from the instance
creation tax discussed on the forum.
Not saying that `bulk_create` couldn't be made faster,
[https://forum.djangoproject.com/t/speeding-up-postgres-bulk-create-by-
using-unnest/36508/1 in fact in should be significantly faster on Postgres
in 5.2], but that this is likely not the right place to discuss it as this
ticket is focused on a very different set of issues that `bulk_update` is
facing.
--
Ticket URL: <https://code.djangoproject.com/ticket/31202#comment:17>
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 visit
https://groups.google.com/d/msgid/django-updates/01070194bde765fe-a3112feb-5889-4f19-91d6-35013959baf5-000000%40eu-central-1.amazonses.com.