top | item 4571411

(no title)

flatline3 | 13 years ago

> Once you deploy then things will change less frequently so the real benefit is when you do have to change something, you're not running a big ALTER statement.

Instead, you're writing a bunch of code to deal with data that may be in the old format, or may be in the new format, or may be in the new-new format.

I don't see that as an improvement.

discuss

order

prodigal_erik|13 years ago

In practice, you're writing code that has to deal with records that were updated by versions 3, 5, and 7 of your code but not 4 or 6. After a few years you can be sure somebody got it wrong at some point, and now you have records in a few out of the 2^n states where not even the developers can anticipate the system's behavior. The fix is to make ALTER incremental and less painful, not to stop writing down and checking your schema.

jeltz|13 years ago

And both MySQL and PostgreSQL have put in work to make ALTER less painful by reducing the situations where a full table rewrite is necessary. In PostgreSQL you can both add and remove columns without the table being rewritten as long as you do not set a default value. You can also increase the lengths of varchars without any rewrite.