diff options
| author | Marti Raudsepp <marti@juffo.org> | 2013-12-12 21:26:57 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-12-14 12:34:45 -0500 |
| commit | 75ec1fdf16ac76b5c945aef1cdb9a1e104369c85 (patch) | |
| tree | afa4b558f75ba348009aed3a9efb1b0cd536a9bd /docs | |
| parent | 668571386926ff5453d0e11f59b0a89c0dc1dfa2 (diff) | |
Clarifed table rewrites in migration docs.
Small nitpicks. All column-related ALTER TABLE commands take an
exclusive table lock in PostgreSQL. The difference is that adding a
column without default doesn't cause a table rewrite, so the lock is
held only for a short time.
The time taken is more accurately proportional to table size, not row
count.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/migrations.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt index 048daaab37..ead5ecffdb 100644 --- a/docs/topics/migrations.txt +++ b/docs/topics/migrations.txt @@ -70,7 +70,7 @@ PostgreSQL PostgreSQL is the most capable of all the databases here in terms of schema support; the only caveat is that adding columns with default values will -lock a table for a time proportional to the number of rows in it. +cause a full rewrite of the table, for a time proportional to its size. For this reason, it's recommended you always create new columns with ``null=True``, as this way they will be added immediately. @@ -83,11 +83,11 @@ meaning that if a migration fails to apply you will have to manually unpick the changes in order to try again (it's impossible to roll back to an earlier point). -In addition, MySQL will lock tables for almost every schema operation and -generally takes a time proportional to the number of rows in the table to -add or remove columns. On slower hardware this can be worse than a minute -per million rows - adding a few columns to a table with just a few million -rows could lock your site up for over ten minutes. +In addition, MySQL will fully rewrite tables for almost every schema operation +and generally takes a time proportional to the number of rows in the table to +add or remove columns. On slower hardware this can be worse than a minute per +million rows - adding a few columns to a table with just a few million rows +could lock your site up for over ten minutes. Finally, MySQL has reasonably small limits on name lengths for columns, tables and indexes, as well as a limit on the combined size of all columns an index |
