|
I guess that's the question, Tamar. When does the added, strictly unnecessary complexity pay off?
And how does time factor into that? Suppose you were expecting the update command to run for 18 hours - just as a very extreme example. I'd want to batch things in that case, as long as it were possible to bring the system back up afterwards with only part of the update completed.
Oracle doesn't do this, but MSSQL and MySQL do. They'll take locks at the row level, so if I've just updated a particular row, no one else can touch that row until my transaction finishes. That's not bad - out of 1m, to have 1 locked is nothing. Nobody else will probably want to touch it. But, when I change the 2nd row, now I have 2 rows locked. Pretty soon it's 100, then 1,000. You see where this is going.
Well, eventually, the database gets to the point where it's using too much memory locking individual rows, and escalates the lock. Now we've got range locks, if they can apply, if not or if they do for a while, we soon escalate again until the entire table is locked. Which means no one else can access it until my transaction commits.
And in a case like that, normally the business rules prevail. There are such and such requirements, there's a time budget for how long things can be taken off line. But this isn't always the case, and quite often we don't have a reliable way to know just how long something will run.
Worse, the business people trust the tech people. Quite often, we don't have a budget. The bosses will say to us "You know our goals and priorities, and you know better than anyone how the system works. Do whatever you think is best for the system."
|