It would be good to see how many database operations we perform within a single
trail. If that number is O(N), then it means that we are holding a lock for an
N-bounded period of time, which could be bad. This is especially bad if the
number of operations is larger, per N.
As a diagnostic to figure out if/where we are holding a trail open for too many
operations, we should add an "op_count" field to the trail structure, and
increment it for each database operation performed within that trail. (and then
somehow, dump out that info as appropriate)
If we find trails with more than, say, a dozen operations in them, then we have
candidates for breaking an operation into smaller component parts which hold DB
locks for shorter periods of time.