Skip to content
About
Main content

What makes a check expensive

Why is a check's cost set by the scope of state it must consult?

What decides how expensive a check is: the scope of state it must consult

is derived from one question: what can be decided using only data we already have, and how much data must we have in hand to decide it?

The answer organizes the whole first half of this mechanism. The cost of a check is not set by how complicated its logic is. It is set by the scope of state it must consult. That scope maps one-to-one onto the operations a query engine already uses (scan, shuffle, ).

Check scopeState requiredCostMarginal cost
Per-valuethe decoded valuenone: rides on parsingabout 0
Per-recordother fields of the same recordnone: rides on parsingabout 0
Per-batchthe partition or time windowone pass plus a about 1 scan, bounded memory
Per-datasetall rows of this tablean index or a shufflean
Cross-datasetanother tablea joinexchange plus a second scan
Cross-timehistorical baselinesstored state plus retrievalstorage plus a consistency problem

Everything in The free tier and Beyond one record is a derivation of what happens at each rung of this ladder, and why the ladder bends where it does.