matc
Not always. Changing the schema can break an application, in particular when the database supports multiple applications.
> It's simple data and some dangling records aren't going to hurt anyone.
It depends on the application. In healthcare people literally die due to some dangling inconsistent records.
The problem in anticipating and working around these inconsistencies is that the workaround is added ad-hoc in code, rather than through a model defining the data change. You need a model http://chronicdb.com/preparing_schema_changes
Migrations are programs, but your existing live application is also a program. Changing the schema breaks your live application to prepare for the new version of the application.
I see you mention several days for the data to be copied, but how about the time to put your solution together and verify it? Also, did recomputing checksums take less time between passes, proportional to the size of the remaining changes?
We didn't find much published material about the best way to do this,
You may want to have a look at our live migration solution: http://chronicdb.com
It goes beyond checksums: it guarantees the data move is atomic and data consistent.
Queries can be fast with indexes without adding complexity.
Ask HN: Databases have indexes. Then why have partitions?
But updateable views are still not what you want! See below.
2. What ChronicDB adds in terms of backward compatibility is, effectively, automatic creation and management of these views for every schema change.
Rather than manually write compatibility views and rewrite/review an application to ensure it always uses these views, programmers instead access plain tables, not views. In fact ChronicDB creates no views at all!
You want to issue SQL queries that don't break. You don't want to manage views to do so. It's a subtle, yet major point. No database to date offers such automated versioning.
ChronicDB of course adds other features we wanted to have from our database (reversibility, data versioning, zero-downtime relocation) again in the spirit of saving the programmer/DBA from doing anything manually.
I'm not sure what you mean by bidirectional. If this suggests having a separate copy for the old data and the new data then, in ChronicDB at least, no they are not bidirectional. Which is what one wants ideally: data consistency.
If you mean that updates on the old version are immediately reflected in the new version, then yes.
Basically, there's a single version of the truth, while old and new relations can have different names, for all DML operations.
If one suggests old data and new data be stored separately then the door to data inconsistency opens.
Also, what makes you say that database as an integration layer should always be avoided?
You may have an old form you can't change.
For example:
- 10 apps connected to the same database. Changing the model breaks 10 apps. And you may not have access to change the code to any of those apps.
- In healthcare, when either the database or app go down people literally die.
This isn't as easy as it gets: no database vendor has a solution for this to date.
(Edit: formatting)
On 6ren's rigidity argument, relations and SQL are still not enough to guarantee you'll always be able to get the data you need; notably, when the data model changes. Backward compatibility is important and we might have they only solution that guarantees it.
There's no reason to not be allowed to both add and remove a column at the same time, or to merge and split whole tables. In your example, these kinds of changes would not be possible.
There's also no reason to not be able to run old and new code at the same time, or to revert a schema change.
With ChronicDB we reduced schema changes to:
$ chd change -f upgrade_map mydb
Schemaless databases don't solve this, just as an instantaneous ALTER TABLE won't solve this.Even if confident your test passed, what happens when you later realize it hadn't, and at what cost?
Denormalization is a performance consideration, and now even happens transparently at the storage layer in some RDBMs. So restructuring a 'live' database should be done for semantic reasons: because the workflow changes; because the app needs to change.
Rate our startup: Git for databases
UNDELETE FROM Whoops;
Ask HN: How would you make Twitter irrelevant?
If there were a way for Twitter to become irrelevant, what would that be?
Why was it possible to make SMS spam, but not email, illegal?
Ask HN: Why don't we get spam on cell phones?
Why don't we get spam on cell phones as text messages, although we get spam via email?