#24203: Optimisation: adding multiple fields to same model should attempt to run
single ALTER TABLE statement
-------------------------------------+-------------------------------------
     Reporter:  peterlauri           |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  migration            |             Triage Stage:
                                     |  Someday/Maybe
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by peterlauri):

 Replying to [comment:2 timgraham]:
 > Could you give some performance numbers for comparison?

 This is not from production, it contains ~500k rows. I will try it out on
 PG as well, just need to prep some data.

 {{{
 mysql> select count(*) from thetable;
 +----------+
 | count(*) |
 +----------+
 |   489484 |
 +----------+
 1 row in set (0.07 sec)

 mysql> ALTER TABLE thetable ADD COLUMN field2 varchar(100) NULL;
 Query OK, 489484 rows affected (2 min 29.05 sec)
 Records: 489484  Duplicates: 0  Warnings: 0

 mysql> ALTER TABLE thetable ADD COLUMN field3 varchar(100) NULL;
 Query OK, 489484 rows affected (2 min 10.82 sec)
 Records: 489484  Duplicates: 0  Warnings: 0

 mysql> ALTER TABLE thetable ADD COLUMN field4 varchar(100) NULL, ADD
 COLUMN field5 varchar(100) NULL;
 Query OK, 489484 rows affected (2 min 24.92 sec)
 Records: 489484  Duplicates: 0  Warnings: 0

 mysql>
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24203#comment:6>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.44408542b604534349e49e10fd317bf6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to