The floors

A floor with two variables in it

Under round-robin a Space-Saving summary's floor is 0.0203·n^1.018 over a hundred-and-twenty-eight-fold range of shard size, worst residual 2.7%. Under hashing the same measurement has no exponent at all — the local slope runs from n^5.17 to n^1.19 — and a least-squares line through it reports n^1.73 at a 441% residual.

The previous essay left a condition dangling. A fold’s charge to a surviving key is one floor per level, and that equals the older model’s m1m-1 leaf floors exactly when the floor doubles as the mass doubles. At eight shards under hashing it does, to within 0.03. At sixty-four it does not, by 0.53.

So: does a Space-Saving floor scale with the arrivals that produced it?

The answer is that the question is malformed, and the way it is malformed is the finding.

The floor against the mass, under a partition that keeps the table's job fixed and one that does notThe smallest counter a Space-Saving summary of 32 settles at, against the arrivals it saw, on log axes where a power law is a straight line. A round-robin shard is a sample of the whole stream and always holds more distinct keys than 32 counters can — the table's share of the shard's key space runs 0.01 to 0.21 — so nothing about the arithmetic changes across the range and the floor is linear: 2.03e-2·n^1.018, worst residual 2.7%. A hashed shard is a scaled copy — 0.077 distinct keys per arrival at every size, to three figures — and what moves instead is the table's share, from 1.33 at the small end, where 32 counters hold the shard's entire key space and the floor is 0.1, to 0.01 at the large end. A range that crosses from an exact structure to a summary is not a line: the local exponent runs from n^5.17 to n^1.19, a least-squares fit would report n^1.73 at a 441% residual, and it is refused. The two meet at the right-hand end because one shard is the whole stream either way.0.111010010³10³10⁴floor, in countsarrivals in the shard, nround-robin — n^1.02hashed — fit refusedresidual 2.7%slope 5.2 → 1.19k = 32 · 40,000 arrivalsthe table holds 1.33 of a hashed shard's keys and 0.01 of the stream's
Fig. 1 The floor a summary of thirty-two counters settles at, against the arrivals it saw, on log axes where a power law is a straight line. One partition gives a line. The other gives a curve that would be reported as a line by any fitter that was not asked to look.

One partition gives a law

Split a forty-thousand-arrival Zipf stream round-robin into 128, 64, 32, … , 1 shards and measure the floor each settles at.

313 arrivals → 6.9. 625 → 14.3. 1,250 → 29.3. 2,500 → 59.6. 5,000 → 120.1. 10,000 → 241.0. 20,000 → 483.0. 40,000 → 967.0.

Fitted: 0.0203n1.0180.0203 \cdot n^{1.018}, worst residual 2.7%. That is a clean law over a hundred-and-twenty-eight-fold range and it is as close to linear as this site’s fits get. Doubling the mass doubles the floor.

The other gives nothing

Split the same stream by hashing the keys and the numbers are these.

313 → 0.1. 625 → 2.8. 1,250 → 10.4. 2,500 → 29.1. 5,000 → 74.8. 10,000 → 180.0. 20,000 → 424.5. 40,000 → 967.0.

The two agree at the right-hand end, as they must: one shard is the whole stream either way, and both read 967. Everywhere else they diverge, and the hashed column is not a power law. The local exponent between adjacent pairs runs 5.17, 1.91, 1.48, 1.36, 1.27, 1.24, 1.19 — still falling at the widest end measured, with no sign of settling.

A least-squares line through those eight points reports n1.73n^{1.73} with a worst relative residual of 441%. The fit is refused. The floor a histogram already knows computes these numbers from a histogram and never had to ask how they scale; asking is what turned up the crossover. Printing an exponent through a slope that is still moving is a number describing none of the points, and this site withdrew two of its earliest complexity claims for exactly that reason.

The floor of each shard, computed from its histogram and then measured8 shards of 40,000 arrivals of stationary Zipf — the control, where a window is a smaller sample, partitioned round-robin: every key on every shard, each summarised by 32 counters. The pale bar is the naive estimate: the mass outside the shard's top 32 keys divided by 32. The mid bar is the fixed point, which divides the same mass by the number of slots that are actually churning. The dark bar is the smallest counter the structure settled at. The fixed point is within 0.6% of it on average; the naive estimate is low by about a factor of 1.8.shard 1 · 120 → 119shard 2 · 121 → 120shard 3 · 120 → 120shard 4 · 121 → 120shard 5 · 119 → 118shard 6 · 124 → 123shard 7 · 121 → 120shard 8 · 122 → 121floor, in arrivalsnaive: tail ÷ kfixed pointmeasuredstationary Zipf · round · k = 321.006× the measured floor
Fig. 2 Per-shard floors under round-robin, all of them at the same place because every shard is a sample of the same stream. This is the flat case, and it is the one the law above is fitted through.

The second variable

The floor is a fixed point over the tail of a shard’s histogram — the mass of everything the table is not holding, shared among the slots that churn. So what it depends on is not the mass but how much of the shard’s key space the table covers, and the two partitions move that quantity in completely different ways.

A round-robin shard is a sample. It sees the whole universe, thinned. Its distinct-keys-per-arrival falls as it grows — 0.479 at the smallest, 0.078 at the largest — because coupon collection saturates. But at every size it holds far more distinct keys than thirty-two counters can: 150 at the smallest shard measured, 3,127 at the largest. The table’s share of the shard’s key space runs from 0.21 down to 0.010, and it is small throughout.

A hashed shard is a scaled copy. Hashing splits the universe, so a shard holds one mm-th of the keys and one mm-th of the mass, and its distinct-keys-per-arrival is 0.078 at every size measured, to three figures. What moves instead is the table’s share of that key space, and it moves across everything: 32 counters against 24 distinct keys at the small end, and against 3,127 at the large end. The share runs from 1.33 down to 0.010.

At 1.33 the table holds the shard’s entire key space. The summary is exact; there is no tail; the floor is 0.1, which is the rounding of nearly nothing. At 0.010 it is a summary and the floor is 967.

A range that crosses from an exact structure to a summary is not a power law over that range, and it should not look like one. It does not.

The point where the structure stops being a summary

The small end of the hashed column is worth its own paragraph, because a floor of 0.1 is not a small floor — it is the absence of one, and it means something different.

At 128 shards a hashed shard holds about 24 distinct keys and 313 arrivals. A table of thirty-two counters never fills. Nothing is ever evicted, so floor is defined as zero by the structure’s own rule, and the 0.1 in the table is the mean over 128 shards of which a handful did fill.

The structure is exact there. It is not a summary of that shard; it is a complete count of it, holding every key with its true frequency, and the error it contributes to a merge is nothing at all. That is why the leaf model’s total collapses at high shard counts: it is summing 127 copies of a number that is nearly zero because the leaves are nearly perfect.

And it is why the level account does not collapse. The leaves are exact and the nodes are not — by the third level of a 128-way fold the subtree holds four shards’ key spaces against the same thirty-two counters, the table has stopped fitting, and the floors begin. The charge is real and it happens entirely above the leaves, which is precisely the region a leaf model cannot see.

This is also the sharpest available statement of what “regime” means for this structure. There are three: one where the table holds everything and the summary is exact, one where it holds a small share and the floor is proportional to the mass, and a crossover between them that is neither. Every published bound is about the second. Every measurement in this collection before these essays was in the second. And a deployment sharding finely enough puts its leaves in the first and its merges in the crossover.

Which is why the leaf model failed where it did

The condition on the identity was “the floor doubles when the mass doubles”. That is now readable as “the table’s share of the key space is not changing”, and the two partitions answer it in opposite ways.

Under round-robin the share is small everywhere and changes only slowly, so the floor scales and the two models agree. Under hashing merging two shards doubles the mass and doubles the distinct keys, so the table’s share halves at every level, so more of the histogram is tail, so the floor more than doubles — 2.53, 2.45, 2.44, 2.40, 2.39 at sixty-four shards.

The departure from doubling is therefore a direct read on how fast the share is moving, and it is the diagnostic the warning that is silent for the right reason puts to work.

What a deployment does with this

Two practical readings, and they point in opposite directions.

Sharding more finely makes the leaves better and the fold worse. Each shard’s table covers more of its own key space, so each shard’s summary is closer to exact — and there are more merges, each of which combines key spaces and pushes the table’s share down. At sixty-four shards the leaves are essentially exact and the surviving key is still charged 409, which is more than the 313 it would be charged at four shards where every leaf is a genuine summary. The intuition that finer sharding gives better per-shard answers is correct and it does not survive the merge.

The width is the knob that reverses it. Doubling kk moves the table’s share up at every level of the fold, and it moves it up most where the fold is deepest. A deployment that has decided on its shard count for reasons of throughput can still choose where the crossover sits, and the choice is worth more at high shard counts than at low ones. What it cannot do is read the right width off any published statement of the structure, because the published statement is ε=1/k\varepsilon = 1/k and takes no view on how many distinct keys are in play.

What a two-variable quantity does to a bound

There is a broader point here about how a quantity like this gets stated, and this site has met it once before.

Two parameters, one bound is where a graph algorithm’s cost turned out to need two variables and a stated density regime, because O(ElogV)O(E \log V) and O(V2)O(V^2) are the same algorithm at different densities and quoting either alone is quoting a regime. The floor is the same shape of object: it is a function of the mass and of the table’s share, and every statement of it so far has held the second fixed by accident.

The difference is that a density regime is something a person states, and the table’s share of a shard’s key space is something a partition sets without anybody choosing it. The partition the analysis did not mention is the first place on this site where a parameter arrived that way, and this is the same parameter arriving again in a quantity nobody had connected to it. Nobody sharding a stream by hash is thinking about how many distinct keys land on each shard; they are thinking about giving each key one home. The consequence for the floor arrives free.

The predicted floor against the floor the structure settled atEach point is one stream and one width: the fixed point computed from the shard histograms, divided by the smallest counter a Space-Saving summary of that width actually settled at, averaged over 8 shards of 40,000 arrivals. One is exact agreement. On the stationary and bursty streams the prediction lands within 4% at every width. On the drifting stream it overshoots by up to 60%, because a histogram of a whole shard has no order in it and the keys that are heavy overall were never heavy at the same time.1.01.21.41.6163264163264163264stationaryburstydriftingpredicted ÷ measuredcounters, kstationaryburstydrifting8 shards · hashed · 40,000 arrivalsworst 1.60× on the drifting stream
Fig. 3 Predicted against measured floors across three streams and three widths. The width is the table’s side of the ratio this essay is about; sweeping it and sweeping the shard count are two ways of moving the same quantity.

The width is the other way to move it

If the share is what matters, then the counter width should be interchangeable with the shard count, and it nearly is.

Thirty-two counters against a sixty-four-way hashed shard is the same share as sixty-four counters against a thirty-two-way one, and the floors ought to correspond. They do to within the noise of a single stream, which is a weaker check than it sounds because the two configurations also differ in absolute mass — and mass is the first variable.

The cleaner statement is the one the refusal already makes. A floor quoted for “a Space-Saving summary of kk counters over nn arrivals” is under-specified, and what is missing is the number of distinct keys in play. Every published statement of this structure’s error is of the form εn\varepsilon n with ε=1/k\varepsilon = 1/k, which is a bound and is correct; the realised floor is far below it and is where all the interesting behaviour lives, and it needs the third number.

The floor is a fixed point, and it takes 14 steps to find itOne shard of 3,815 arrivals, a summary of 64 counters. The iteration starts at the naive estimate — the mass outside the top 64 keys, divided by 64, which is 13 — and each step recomputes how many of the 64 slots are actually churning at the current floor. It settles at 29 on 52 churning slots, and the structure's smallest counter is 29. The gap between the first step and the last is the 12 counters that hold keys heavy enough never to be evicted, and therefore carry no error to share.measured 29naive 13floor, in arrivalsiteration024681012stationary Zipf · shard 1 of 8 · k = 641.012× the measured floor
Fig. 4 The fixed point converging. Its input is a histogram, so the distinct-key count is already in there — the two-variable dependence is present in the computation and absent from every summary of it.

The same iteration on a stream whose favourites move is the check that the third variable is doing the work rather than the stationarity. A drifting shard’s histogram has a longer body and a shorter head, so more of its slots churn — and the fixed point should land higher for that reason and not because anything about the width or the mass has changed.

The floor is a fixed point, and it takes 14 steps to find itOne shard of 5,657 arrivals, a summary of 32 counters. The iteration starts at the naive estimate — the mass outside the top 32 keys, divided by 32, which is 13 — and each step recomputes how many of the 32 slots are actually churning at the current floor. It settles at 43 on 19 churning slots, and the structure's smallest counter is 33. The gap between the first step and the last is the 13 counters that hold keys heavy enough never to be evicted, and therefore carry no error to share.measured 33naive 13floor, in arrivalsiteration024681012the popular keys drift · shard 1 of 8 · k = 321.298× the measured floor
Fig. 5 The same convergence on a drifting shard of 5,657 arrivals at half the width. It opens at the naive estimate of 13 — the mass outside the top thirty-two keys, divided by thirty-two — and settles at 43 on nineteen churning slots, against the structure’s own smallest counter of 33. Thirteen of the thirty-two counters hold keys too heavy ever to be evicted, so they carry no error to share, and it is that count — not nn and not kk — that moves between the two plates.

The refusal, and the machinery for it

A fit that declines to publish is a small piece of machinery and it is the load-bearing part of this essay, so it is worth saying how it decides.

It computes the local exponent between each adjacent pair of points and looks at the spread. If one exponent describes the range, those numbers agree; if the slope is drifting, they do not. Under round-robin they span 0.08 and the fit is offered. Under hashing they span 3.98 and it is withheld.

The check that keeps it honest is the one that would otherwise be missing: the fit must still have been computed. A refusal that came from the fitter failing to converge, or from too few points, would be the right answer arrived at by accident and would stop being the right answer as soon as somebody added a point. So the hashed sweep returns the fit it declined to publish, and the check asserts both that the published one is absent and that the attempted one exists.

Two declared complexity claims were withdrawn among this site’s earliest work because the fit refused them, and the machinery for refusing has been here since. What was missing was a refusal criterion that could see a drifting slope, as opposed to a poor one — a residual measures distance from a line and says nothing about whether a line was the right object.

A merged summary's floor is not the floor a summary settles atAt each level of a fold of 32 shards: the floor the merged summary carries, and the floor a fresh summary of the same width settles at when it is run over the same arrivals. The merged one is lower at every level — a share of 0.71 to 0.83 here — because merging preserves the heavy counters exactly and never runs their eviction cascade. The share is not one number: it falls once per level of the fold, and across shard counts it is straight in log₂ m at 1.007 − 0.0518·log₂ m, worst residual 3%. It is the one quantity in this arithmetic that no histogram contains.10010³10.8320.7530.7140.7550.72floor, in countslevel of the fold, and the sharea fresh summary's floorthe merged summary's floor32 shards · k = 32 · hashedshare 0.71–0.83 over the levels
Fig. 6 A merged summary’s floor against a fresh summary’s, level by level. A third quantity again, and the one that turns this essay’s diagnosis into a working prediction.

Where this sits among the other floors

This site has a field called floors and it has, until now, been about lower bounds — the comparison floor, the state floor, the one-pass floor. Those are statements that nothing can do better, proved by counting.

The floor in this essay is a different object with the same name, and the collision is worth naming rather than tolerating. A Space-Saving floor is the smallest counter in a table: an observed quantity that the structure settles at, which decides how wrong its answers are and which nothing about the problem forces. The floor under every comparison sort is a floor nobody can get under. This is a floor the structure ends up at.

The two do have something in common and it is the thing this essay is about. The floor moves when the question does makes the case that a lower bound is a function of what is being asked, and quoting one without its question is quoting half of it. The same is true here in a different variable: the settled floor is a function of the table’s share of the key space, and quoting one without that is quoting half of it too. Both are cases of a number that reads as a property of a structure and is a property of a structure and a situation.

The floor of each shard, computed from its histogram and then measured8 shards of 40,000 arrivals of stationary Zipf — the control, where a window is a smaller sample, partitioned hashed by key: every key on one shard, each summarised by 32 counters. The pale bar is the naive estimate: the mass outside the shard's top 32 keys divided by 32. The mid bar is the fixed point, which divides the same mass by the number of slots that are actually churning. The dark bar is the smallest counter the structure settled at. The fixed point is within 1.4% of it on average; the naive estimate is low by about a factor of 2.2.shard 1 · 69 → 69shard 2 · 88 → 87shard 3 · 65 → 64shard 4 · 97 → 95shard 5 · 72 → 71shard 6 · 81 → 80shard 7 · 71 → 70shard 8 · 64 → 62floor, in arrivalsnaive: tail ÷ kfixed pointmeasuredstationary Zipf · hashed · k = 321.014× the measured floor
Fig. 7 The fixed point against the measured floor, per hashed shard at eight shards. Every one of these is inside the second regime — the table holds a small share, the floor scales with the mass, and the prediction is exact.

The bill a partition only divides shows the two structures’ damages summing to the sum of the shard floors — an exact conservation, and one whose terms are now known to be regime-dependent quantities. The conservation survives, because both sides are computed from the same floors; what moves is what those floors are worth.

The share does not collapse the two columns

The interchangeability claim above is checked against the noise of one stream and flagged as weak because mass confounds it. The confound is removable: divide each floor by its shard’s arrivals and the first variable is gone, leaving a quantity that should depend on the share alone if the share is the whole story.

Under round-robin, floor per arrival runs 0.0220, 0.0229, 0.0234, 0.0238, 0.0240, 0.0241, 0.0242, 0.0242 across the eight shard sizes — flat to within ten per cent, which is the same fact as the exponent of 1.018.

Under hashing it runs 0.0003, 0.0045, 0.0083, 0.0116, 0.0150, 0.0180, 0.0212, 0.0242 — a factor of seventy-six, which is the crossover.

Now put them on the share instead. Hashing holds distinct keys at 0.078 an arrival throughout, so the shares are 1.31, 0.66, 0.33, 0.16, 0.082, 0.041, 0.021, 0.010, and the two columns can be read against each other wherever the shares meet.

At the largest shard both partitions are the same object and both read 0.0242 at a share of 0.010, which is a consistency check rather than evidence. The informative comparison is at the round-robin sweep’s small end: a share of 0.21, at which round-robin’s floor per arrival is 0.0220. Interpolating the hashed column between its 0.16 and 0.33 points puts hashing’s value at that share near 0.011.

A factor of two apart, at the same share. So the share is a necessary second variable and it is not a sufficient one, and the two knobs are not interchangeable after all — the check that found them “interchangeable to within the noise” was comparing configurations whose masses differed by enough to hide it.

The mechanism is visible once the two partitions are described as operations on a histogram rather than on a stream. Round-robin thins every key’s count by mm and keeps every key. Hashing keeps every count intact and discards all but one key in mm. Both leave the table holding thirty-two counters against a similar number of distinct keys, so both produce the same share — and they have done completely different things to the tail the fixed point is computed over.

A thinned histogram has the global shape with every atom shortened, so its tail is many tiny counts. A subsampled one has a random handful of the global atoms at full height, so its tail is fewer, larger counts. The fixed point divides tail mass among churning slots, and those two tails divide differently at equal mass and equal count.

Which is exactly the sentence the section below reaches for and states as a caution rather than a result: the shape of the resulting histogram is what decides how the floor responds. It is not a fourth variable waiting on a Zipf exponent — it is a third variable already separating two columns on this page, and the floor a histogram already knows computes from the histogram directly and is therefore right about both without needing to name any of them.

The negative that survives is the one the essay is for, strengthened rather than weakened. A floor is not a function of the arrivals; it is not a function of the arrivals and the share either; and every quantity that would pin it down is a thing the partition the analysis did not mention sets without being asked.

What is left open

The crossover has no closed form here. What is measured is that it exists, where it sits for this stream and this width, and what its two ends look like. A treatment that predicted the shape of the curve — rather than declining to fit a line to it — would need the Zipf exponent as a fourth input, and the whole point of the fixed point is that it works from a histogram rather than from a fitted distribution.

And nothing here measures a stream that is not Zipf. The 0.078 distinct-keys-per-arrival constancy under hashing is a consequence of hashing splitting the universe uniformly, which holds for any key distribution; the shape of the resulting histogram is what decides how the floor responds, and a uniform key distribution would put the crossover somewhere else entirely.

What is robust is the negative and it is the one the next essays rest on: a floor is not a function of the arrivals alone, one partition on this site holds the second variable nearly still and one moves it across a crossover, and every earlier statement about floors on this site was made under the first.

What this makes readable

Essays that name this one as a prerequisite.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

What links here

Every essay whose body links to this one.

The objects this essay names

Each one links to every other essay that touches it.

CrossoverCurve fittingFinite size effectFittingFixed pointHistogramHonest limitMeasurementPartitionRegimeShardSpace-savingTwo parameter boundZipf distribution