3

Doing a little digging into why South migration was so slow on production data I found that it's doing a separate ALTER TABLE for each column added to the table. In the case of our larger tables they have tens of millions of rows, and I'm adding quite a few columns, so it ends up being very slow.

Is there a way to combine the multiple ALTER TABLE statements South produces into a single statement, and if so would that be faster than several individual statements (I assume it would)?

It looks like there isn't a way to get South to print the SQL it uses. Are there any tricks for getting even partial SQL from south? I can hand-assemble the alter table if I can get the individual parts.

Parand
  • 102,950
  • 48
  • 151
  • 186

1 Answers1

0

South use ORM for own queries, so use this

./manage.py shell

from django.db import connection
    print connection.queries

BUT I'm strongly recommend for hiload/sensitive data solutions using DB console and manually written SQLs ( with full backups of cource )

Community
  • 1
  • 1
b1_
  • 2,069
  • 1
  • 27
  • 39