Recently during a deployment we kept hitting deadlocks. The reason for the deadlocks was that too many nodes were being updated during updatedb at once. To avoid this problem we needed to find a way to run those updates in batches instead of all together. It turns out there is an argument to hook_update() called $sandbox. $sandbox is passed-by-reference so that it will be remembered over itterations. Using this we can limit how many nodes are updated over a pass, and avoid bottlenecks. Here is an example: