Skip to content
About
Main content
Trade-off

Exactness vs. approximation

Where you meet it: sketches, sampling, ANN.

What it is

One more mechanism deserves its own place. Sampling (TABLESAMPLE, block sampling, approximate query processing) is a deliberate data-reduction step. It is the only mechanism in this article that reduces data without preserving the exact answer. That makes it the natural home of the trade between exactness and approximation, and a clean contrast with everything else here. Bloom filters are approximate too, but their error only costs extra reads, never a wrong answer. A sample's error appears in the answer itself. A dashboard that shows "about 1.2 million" can use it; a financial close cannot.

From Query Planning & Optimization › Late materialization, sampling

Sliding window counter. The practical compromise. Interpolate between the previous and the current fixed window according to how much of the current window has elapsed. It uses O(1) memory, is approximately correct, and has no boundary spike. This is a trade of exactness for approximation, and it is almost always the right trade: nobody needs a rate limit to be exact to the single request.

From Data Movement › Rate limiting and pacing

Where it appears

In 14 mechanisms. Each says what the mechanism is about, then how this trade-off shows up there, in its own words.

Made on the same pages most often.