Definition · The two placementsFor a computation over a dataset of D bytes that emits result bytes, with code bytes of program, across a link of bw bytes a second:
move the data takes D/bw;
move the compute takes (code + result)/bw.
The processing itself is assumed to take the same time wherever it runs, so it appears on both sides and cancels with the bandwidth.
D = 2 TB = 2 000 000 MB result = 5 MB code = 200 kB
bw = 1 000 Mbit/s = 125 MB/s
move the data 2 000 000 ÷ 125 = 16 000 s = 4.44 h
move the compute 5.2 ÷ 125 = 0.0416 s = 41.6 ms
ratio of the two 16 000/0.0416 = 384 615.4×
result/input 5 MB / 2 TB = 1/400 000
the tie code + result = D ⟹ result ≈ 2 TB
4.44 hours against 41.6 milliseconds is not a close call, and the gap is not a property of this link. Put both plans on a connection a hundred times faster and they become 160 seconds and 0.42 milliseconds — the same factor of 384 615, because both numerators were divided by the same thing.
The cancellation, written out
It is worth doing explicitly, because the conclusion that a faster network does not change the decision is counter-intuitive enough to need the algebra rather than the assertion.
move the compute is faster when
(code + result)/bw < D/bw
multiply both sides by bw > 0:
code + result < D
no bandwidth anywhere: the decision is bytes against bytes,
and the link only sets how long the winner takes.
Example · A count over two terabytesThe dataset is 2 TB; the job is a few hundred kilobytes of code; the answer is a single number. Moving the data takes 4.44 hours and moving the compute takes 41.6 milliseconds, and the ratio 1/400 000 is generous — a count returns a few bytes, so the true ratio is nearer 10⁻¹². Every database that pushes a predicate down to the storage layer is making this comparison implicitly.
When the usual answer is wrong
The comparison inverts exactly when the result is not small. A job that decompresses, joins or enriches can emit more than it reads, and then code + result > D and the data should come to the compute — or, better, the job should be split so that the reducing part runs next to the data and only its output travels.
There are also constraints that are not about time at all. The data may not be allowed to leave its jurisdiction, in which case the compute moves regardless of sizes; or the code may not be allowed to run next to the data, in which case it cannot move whatever the arithmetic says. Both are constraints applied before this calculation, not terms inside it.
The third case is repetition. One transfer of 2 TB followed by a thousand local queries is a different plan from a thousand remote queries, and the comparison to make is D against 1 000 × (code + result). That is still bytes against bytes, with the same cancellation; only the counts changed.
The assumption that the processing takes the same time in both places is the one this model leans on, and it is the one to check. If the data’s home is a storage tier with little processor beside it, moving the compute there may be slower in total even though it moves almost no bytes — and then the right answer is the one the measurement gives rather than the one the ratio suggests.