#35904: Speed up fixture loading by adding options bulk insert/create
-----------------------------------+--------------------------------------
     Reporter:  JorisBenschop      |                    Owner:  (none)
         Type:  New feature        |                   Status:  new
    Component:  Testing framework  |                  Version:  5.0
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  1                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Description changed by JorisBenschop:

Old description:

> As per ​this forum discussion, I have created a patch to improve load
> times for the loaddata command under some circumstances.
>
> Currently the “loaddata” management command uses the obj.save() method
> for each deserialized object within a fixture. This function first tries
> an UPDATE statement and, if that fails, tries an INSERT statement. By
> using the --force_insert a reduction of 50% of queries is achieved.
>
> A second option is to use bulk_create for insertion of multiple records.
> This improves insertion speed by (n-1/n), or ~99% for insertion of 100
> records.
>
> These options are not meant to cover each use case, and therefore are set
> to optional.

New description:

 As per ​this forum discussion, I have created a patch to improve load
 times for the loaddata command under some circumstances.

 Currently the “loaddata” management command uses the obj.save() method for
 each deserialized object within a fixture. This function first tries an
 UPDATE statement and, if that fails, tries an INSERT statement. By using
 the --force_insert a reduction of 50% of queries is achieved.

 A second option is to use bulk_create for insertion of multiple records.
 This improves insertion speed by (n-1/n), or ~99% for insertion of 100
 records.

 These options are not meant to cover each use case, and therefore are set
 to optional.

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35904#comment:4>
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/010701939b83f8ee-b4db16d6-4c57-4db7-a5d1-30e8fda6ce72-000000%40eu-central-1.amazonses.com.

Reply via email to