When it does not fit

A floor under every level

A levelled store's filter memory divided by its levels' sizes lost up to 26 points of a perfect filter's saving part way through its fill, every large loss a level given no filter at all. A floor of half a bit a key under every level was predicted to close every gap above five points at one bit a key and cost nothing at two and four. It closes them: the worst gap at one bit falls from 17 points to 4 on the shuffled store and from 25 to under 1 on the clustered one, and nothing moves at two bits and up. At half a bit a key the floor is the whole budget and the rule becomes the even split, which the clustered store wants half way through and the shuffled store, at the same sizes, loses 35 points by.

The sizes a store passes through followed a rule for dividing a levelled store’s range-filter memory through the store’s fill. The rule reads only the levels’ sizes: δ\delta more bits a key for every factor of four a level is smaller than the deepest, snapped to a grid of bit counts, the base raised until the budget is spent. On the full store it matched the division fitted to the store’s own queries. Through the fill it fell up to 17 points of a perfect filter’s saving behind on the shuffled store and 26 on the store filled a cluster at a time, at a bit a key or less, and every large loss had one cause. Part way through the fill the deepest level holds a smaller share of the store, the small levels can absorb most of the budget, the base for the deepest level falls below half a bit, and the snap rounds it to nothing: a level holding most of the keys gets no filter, and every query that reaches it reads it.

Its closing section proposed saying outright what the fitted division did implicitly. From one bit a key up, the fitted division gives every level at least half a bit at every checkpoint of the fill on both orders. A rule could give every level a floor of half a bit a key and divide what remains of the budget by sizes as before. The prediction was that the floor would close every gap larger than five points, since each was a level given nothing, would bring the worst gap at one bit a key under three points on both orders, and would cost nothing at two and four bits a key, where the rule already gives every level half a bit or more. It named the failure in advance: at half a bit a key the floor is the whole budget, the rule becomes the even split, and the even split is right half way through the clustered store and wrong on the full shuffled store by 34 points.

All three parts of that came true, the failure included, and the failure turns out to be about the arrival order rather than the floor.

Half a bit before anything is divided

The store, the queries, the checkpoints and the accounting are the earlier essays’. The store holds 2202^{20} keys in sixteen clusters, filled shuffled or a cluster at a time, and is read at an eighth, a quarter, three eighths, a half, three quarters and the whole of its keys. At each checkpoint every level’s filter cost at every grid value from nought to sixteen bits a key is read on two seeds of queries; the fitted division is the cheapest assignment on the choosing seed, and every division is charged on the charging seed as the share of a perfect filter’s saving it captures.

The floored rule computes each level’s bits exactly as the rule chosen before the queries arrive did, δ\delta times its factors of four below the deepest plus a base, snapped to the grid, and then raises any level below half a bit to half a bit. The base is then the largest whose division fits the budget. When the budget is under half a bit a key the floor is dropped, and when it is exactly half a bit the floor uses all of it. It is run at δ\delta = 2, 4 and 8, and the rule at δ=4\delta = 4 without a floor is the earlier essay’s to the bit.

Seventeen points become four

On the shuffled store at 1 bit a key, a floor of half a bit under every level brings the size rule's worst gap to the fitted division over the fill from 17.3 points to 4.1: 59.0%, 82.7%, 86.4%, 78.8%, 85.4%, 97.2% at the six checkpoints, against 59.0%, 82.7%, 85.7%, 82.9%, 87.0%, 97.2%The shuffled store at 1 bits a key, at six points of the fill: the share of a perfect filter's saving captured by the fitted division, by the size rule at δ = 4 with no level given under half a bit a key, and by the same rule with no floor, all charged on unseen queries. an eighth: fitted 59.0% at 6/1/0.5, floored 59.0% at 6/1/0.5, unfloored 56.8% at 6/2/0; a quarter: fitted 82.7% at 8/0.5, floored 82.7% at 8/0.5, unfloored 82.7% at 8/0.5; three eighths: fitted 85.7% at 16/2/0.5, floored 86.4% at 8/3/0.5, unfloored 68.3% at 12/4/0; half: fitted 82.9% at 6/6/1/0.5, floored 78.8% at 8/6/0.5/0.5, unfloored 70.1% at 8/8/1/0; three quarters: fitted 87.0% at 16/4/2/0.5, floored 85.4% at 8/4/2/0.5, unfloored 74.6% at 12/6/4/0; all: fitted 97.2% at 16/8/0.5, floored 97.2% at 16/8/0.5, unfloored 97.2% at 16/8/0.5.0.6000.8001share of the keys arrivedshare of a perfect filter's saving1/81/43/81/23/41fitted to the queriesthe rule, floor of half a bitthe rule, no floorthe shuffled store, 1 bit a keycharged on unseen queries
Fig. 1 The shuffled store at one bit a key, the share of a perfect filter’s saving at each checkpoint. Fitted: 59.0%, 82.7%, 85.7%, 82.9%, 87.0%, 97.2%. The rule with a floor of half a bit: 59.0%, 82.7%, 86.4%, 78.8%, 85.4%, 97.2%. The rule with no floor: 56.8%, 82.7%, 68.3%, 70.1%, 74.6%, 97.2%.

On the shuffled store at one bit a key, the floor brings the rule’s worst gap to the fitted division over the fill from 17.3 points to 4.1: 86.4% of a perfect filter’s saving three eighths of the way through, where the unfloored rule captured 68.3% and the fitted division 85.7%. At three eighths the floored rule is a little above the fitted division on the charging seed, by seven tenths of a point, which the fitted division, chosen on a different seed, can lose by. At an eighth it now matches exactly. At three quarters it trails by 1.6 points.

The floor does what the diagnosis said it would. Three eighths of the way through, the rule now gives the levels 8, 3 and half a bit a key where it gave 12, 4 and nothing; the half bit it gives the deepest level costs it a third of the small levels’ bits, and buys back seventeen points, because the deepest level holds 83% of the keys and every range query reaching it was a read.

On the store filled a cluster at a time at 1 bit a key, a floor of half a bit under every level brings the size rule's worst gap to the fitted division over the fill from 24.8 points to 0.9: 94.5%, 99.3%, 99.0%, 98.6%, 99.4%, 99.8% at the six checkpoints, against 94.5%, 99.3%, 99.9%, 99.4%, 99.6%, 99.8%The store filled a cluster at a time at 1 bits a key, at six points of the fill: the share of a perfect filter's saving captured by the fitted division, by the size rule at δ = 4 with no level given under half a bit a key, and by the same rule with no floor, all charged on unseen queries. an eighth: fitted 94.5% at 6/1/0.5, floored 94.5% at 6/1/0.5, unfloored 73.0% at 6/2/0; a quarter: fitted 99.3% at 8/0.5, floored 99.3% at 8/0.5, unfloored 99.3% at 8/0.5; three eighths: fitted 99.9% at 16/1/0.5, floored 99.0% at 8/3/0.5, unfloored 75.1% at 12/4/0; half: fitted 99.4% at 12/2/1/0.5, floored 98.6% at 8/6/0.5/0.5, unfloored 79.2% at 8/8/1/0; three quarters: fitted 99.6% at 12/1/2/0.5, floored 99.4% at 8/4/2/0.5, unfloored 83.6% at 12/6/4/0; all: fitted 99.8% at 12/8/0.5, floored 99.8% at 16/8/0.5, unfloored 99.8% at 16/8/0.5.0.7000.8000.9001share of the keys arrivedshare of a perfect filter's saving1/81/43/81/23/41fitted to the queriesthe rule, floor of half a bitthe rule, no floorthe store filled a cluster at a time, 1 bit a keycharged on unseen queries
Fig. 2 The store filled a cluster at a time, at one bit a key. Fitted: 94.5%, 99.3%, 99.9%, 99.4%, 99.6%, 99.8%. With a floor: 94.5%, 99.3%, 99.0%, 98.6%, 99.4%, 99.8%. With no floor: 73.0%, 99.3%, 75.1%, 79.2%, 83.6%, 99.8%.

On the store filled a cluster at a time, at one bit a key, the floor brings the worst gap from 24.8 points to 0.9. The unfloored rule had fallen below the even split at four of the six checkpoints; floored, it is within a point of the fitted division at all six. The prediction’s under-three holds here with room to spare, and misses on the shuffled store by a point.

What the last four points are

The remaining gap on the shuffled store is half way through the fill, where the store has four levels of 12,288, 20,480, 163,840 and 327,680 keys. The floored rule gives them 8, 6, a half and a half bits a key; the fitted division gives 6, 6, 1 and a half. The difference is the third level, which holds 31% of the keys and is half the size of the deepest: the fitted division gives it a whole bit, the rule only the floor.

That is the same blind spot one level up. The rule reads the third level as half a factor of four smaller than the deepest and gives it half of δ\delta more bits, which at a budget of one bit a key and a base below nought is still under half a bit before the floor. A floor fixes the level that gets nothing; it cannot tell a level that deserves a little from one that deserves a whole bit. Half way through the shuffled fill, that difference is four points of the saving.

Where the half bit comes from

The floor’s half bit for the deepest level has to come from somewhere in a fixed budget, and it comes from the small levels. Three eighths of the way through the shuffled fill, at one bit a key, the floored rule gives the smallest level 8 bits a key where the unfloored rule gave 12 and the fitted division gives 16; three quarters of the way through it gives 8 where the fitted division gives 16. The smallest level holds about 1% of the keys, so halving its bits frees a fifth of a bit a key across the store, and the deepest level’s half bit costs about that much.

The small level barely notices. At three eighths the floored rule captures 86.4% of the saving with 8 bits on the smallest level, and the fitted division 85.7% with 16. The earlier essays found the small levels’ curves flat at the top of the grid, as the point filters each run carries had found for lookups of missing keys, where the same memory moved from the large level to the small ones bought reads back, where every query that reaches a small level is already almost always ruled out, and the last eight bits a key buy almost nothing. The deepest level’s curve is steep near nought instead, and this plate measures how steep: its first half bit a key, paid for by the small levels, is worth eighteen points here. The small levels’ share of a range filter found the same trade from its other end, recovering more than half of a store’s gap by moving bits from the largest level to the small ones; it holds only until the largest level’s last half bit is taken. The floor moves memory from the flattest part of one curve to the steepest part of another, which is why a fifth of a bit a key buys so much.

On the clustered store the same exchange is cheaper still. Three eighths of the way through, the floored rule gives the levels 8, 3 and half a bit a key where the fitted division gives 16, 1 and half a bit, and captures 99.0% of the saving against 99.9%.

Nothing moves where the budget is larger

With a floor of half a bit, the rule at δ = 4 is within 4.1 points of the fitted division at every checkpoint at one bit a key and unchanged at two and four; at half a bit a key the floor is the whole budget, the rule becomes the even split, and it falls 34.8 points behind on the shuffled storeFor each order and budget, the most points of a perfect filter's saving by which the size rule trails the fitted division over the six checkpoints: with no floor at δ = 4 (grey), and with a floor of half a bit at δ = 2, 4 and 8. shuffled at 0.5: no floor 9.3; floored δ 2 34.8, δ 4 34.8, δ 8 34.8; shuffled at 1: no floor 17.3; floored δ 2 6.7, δ 4 4.1, δ 8 5.4; shuffled at 2: no floor 4.2; floored δ 2 10.8, δ 4 4.2, δ 8 4.1; shuffled at 4: no floor 4.1; floored δ 2 6.3, δ 4 4.1, δ 8 0.6; batched at 0.5: no floor 26.1; floored δ 2 9.1, δ 4 9.1, δ 8 9.1; batched at 1: no floor 24.8; floored δ 2 1.6, δ 4 0.9, δ 8 4.3; batched at 2: no floor 0.7; floored δ 2 2.3, δ 4 0.7, δ 8 1.5; batched at 4: no floor 0.6; floored δ 2 0.9, δ 4 0.6, δ 8 0.2.no floor, δ = 4floor, δ = 2floor, δ = 4floor, δ = 80 points10 points20 points30 pointsshuffled, 0.5 bitsshuffled, 1 bitshuffled, 2 bitsshuffled, 4 bitsa cluster at a time, 0.5 bitsa cluster at a time, 1 bita cluster at a time, 2 bitsa cluster at a time, 4 bitsworst points behind the fitted divisionsix checkpoints of the fill
Fig. 3 For each order and budget, the most points by which the rule trails the fitted division over the fill: with no floor at δ = 4, and with a floor of half a bit at δ = 2, 4 and 8. At one bit: shuffled 17.3 without; 6.7, 4.1 and 5.4 with. A cluster at a time: 24.8 without; 1.6, 0.9 and 4.3 with. At two and four bits the floored rule at δ = 4 is 4.2, 4.1, 0.7 and 0.6, as without. At half a bit: shuffled 9.3 without and 34.8 with at every δ; a cluster at a time 26.1 without and 9.1 with.

At two and four bits a key the floor changes nothing at δ = 4: the worst gaps stay at 4.2 and 4.1 points on the shuffled store and 0.7 and 0.6 on the clustered one. At those budgets the rule already gives every level at least half a bit at every checkpoint, so the floor never binds. The prediction that it would cost nothing there holds exactly.

The plate also settles δ\delta. With the floor, four is the best of the three values tried at one bit a key on both orders, 4.1 and 0.9 points against 6.7 and 1.6 at two and 5.4 and 4.3 at eight. The sizes a store passes through found that no δ\delta alone could stay within two points everywhere, because the parameter was doing two jobs; with the floor taking one of them, the earlier essay’s own δ\delta is the right one again.

Half a bit, and two stores that want opposite things

On the shuffled store at 0.5 bits a key, a floor of half a bit under every level raises the size rule's worst gap to the fitted division over the fill from 9.3 points to 34.8: 21.7%, 38.4%, 33.0%, 34.7%, 33.2%, 37.6% at the six checkpoints, against 40.5%, 54.7%, 65.2%, 61.1%, 68.0%, 71.5%The shuffled store at 0.5 bits a key, at six points of the fill: the share of a perfect filter's saving captured by the fitted division, by the size rule at δ = 4 with no level given under half a bit a key, and by the same rule with no floor, all charged on unseen queries. an eighth: fitted 40.5% at 3/1/0, floored 21.7% at 0.5/0.5/0.5, unfloored 39.9% at 4/0.5/0; a quarter: fitted 54.7% at 8/0, floored 38.4% at 0.5/0.5, unfloored 54.7% at 8/0; three eighths: fitted 65.2% at 16/2/0, floored 33.0% at 0.5/0.5/0.5, unfloored 63.5% at 8/2/0; half: fitted 61.1% at 8/4/0.5/0, floored 34.7% at 0.5/0.5/0.5/0.5, unfloored 51.8% at 6/6/0/0; three quarters: fitted 68.0% at 8/4/2/0, floored 33.2% at 0.5/0.5/0.5/0.5, unfloored 68.0% at 8/4/2/0; all: fitted 71.5% at 16/6/0, floored 37.6% at 0.5/0.5/0.5, unfloored 70.6% at 12/6/0.0.2000.4000.6000.8001share of the keys arrivedshare of a perfect filter's saving1/81/43/81/23/41fitted to the queriesthe rule, floor of half a bitthe rule, no floorthe shuffled store, 0.5 bits a keycharged on unseen queries
Fig. 4 The shuffled store at half a bit a key. Fitted: 40.5%, 54.7%, 65.2%, 61.1%, 68.0%, 71.5%. With a floor, which is the even split at this budget: 21.7%, 38.4%, 33.0%, 34.7%, 33.2%, 37.6%. With no floor: 39.9%, 54.7%, 63.5%, 51.8%, 68.0%, 70.6%.

At half a bit a key the floored rule is the even split, and on the shuffled store it falls 16 to 35 points behind the fitted division at every checkpoint, against at most 9.3 for the unfloored rule. The named failure is exactly as named: on the full shuffled store the even split captures 37.6% and the fitted division 71.5%, a gap of 34 points, and three quarters of the way through it is 34.8.

On the store filled a cluster at a time the same floor costs little: the even split matches the fitted division at four of the six checkpoints, and trails by 5.3 points at an eighth and 9.1 at the full store, against the unfloored rule’s 26.1 at half way. So at half a bit the floor turns the worst case from the clustered store to the shuffled one and makes it worse. Neither rule is safe at this budget on both orders, and the next plate shows why no rule that reads only sizes could be.

Half of the way through the fill, at 0.5 bits a key, the two arrival orders have the same levels and want opposite divisions: the shuffled store's fitted division gives them 8, 4, 0.5, 0 bits a key and captures 61.1%, the clustered store's gives 0.5, 0.5, 0.5, 0.5 and captures 82.0% — a rule that reads only sizes must be wrong on one of themAt half of the fill and 0.5 bits a key, levels of 12,288, 20,480, 163,840, 327,680 keys on both orders: the bits a key the fitted division gives each level on the shuffled store and on the store filled a cluster at a time, with the share of a perfect filter's saving each captures; the size rule at δ = 4 captures 51.8% on shuffled and 55.9% on batched, and with a floor of half a bit 34.7% on shuffled and 82.0% on batched.fitted, shuffled storefitted, a cluster at a time0481216level 112,288 keys · 2%8 · 0.5level 220,480 keys · 4%4 · 0.5level 3163,840 keys · 31%0.5 · 0.5level 4327,680 keys · 63%0 · 0.5bits a key, smallest level at the tophalf of the fill0.5 bits a key
Fig. 5 Half way through the fill, at half a bit a key, both orders have levels of 12,288, 20,480, 163,840 and 327,680 keys. The shuffled store’s fitted division gives them 8, 4, 0.5 and 0 bits a key and captures 61.1% of a perfect filter’s saving; the clustered store’s gives each half a bit and captures 82.0%.

Half way through the fill, at half a bit a key, the two arrival orders have identical levels and their fitted divisions are opposite: the shuffled store wants 8, 4, a half and nothing, the small levels richly filtered and the deepest bare; the clustered store wants half a bit everywhere. A rule that reads only sizes sees the same input on both stores and must give the same answer, so it is wrong on one of them whatever it gives. The unfloored rule gave 6, 6, nothing and nothing, near the shuffled store’s answer, and lost 26 points on the clustered store; the floored rule gives the clustered store’s answer and loses 26 on the shuffled one.

The likeliest reason, which this measurement does not isolate, is in what a filter buys on each store. Filled a cluster at a time, each level’s keys come from few clusters, so a level’s key range is narrow and most range queries fall outside it before any filter is asked; what is left for the filters is a little everywhere, and half a bit a key everywhere buys it. Filled shuffled, every level spans the whole key space and every query overlaps every level, so a filter is asked on every level for every query, and memory spent where it rules out the most reads per bit, on the small levels, is worth the most. One bit a key, divided found the arrival order mattering more than the choice of prefix lengths; at half a bit it matters more than the levels’ sizes too.

What the prediction got right

The closing section predicted that a floor of half a bit a key would close every gap larger than five points. At one bit a key and above it closes all of them; the largest left anywhere at those budgets is 4.2 points. It predicted the worst gap at one bit would fall under three points on both orders: 0.9 on the clustered store and 4.1 on the shuffled one, where the remaining gap is a level given the floor that deserved a whole bit. It predicted the floor would cost nothing at two and four bits a key, and the worst gaps there do not move.

It named the failure at half a bit, that the floor would be the whole budget and the rule the even split, right half way through the clustered store and 34 points wrong on the full shuffled store, and both halves of that are measured to the point. What it did not say is that the failure belongs to the budget rather than to the floor: at half a bit the two orders want opposite divisions of identical levels, and the floor only decides which of them the rule is wrong on. The question was whether the rule’s real parameter is how fast bits grow up the levels or how little the deepest level may be given. At a bit a key and above, it is the second, and a floor set before the store knows its shape is enough for every shape it passes through. At half a bit it is neither; it is the order the keys arrived in.

What the floor leaves out

A floor of one size. Half a bit is the grid’s lowest non-zero step. A floor of a whole bit was measured too, and at one bit a key it is the even split again, losing 44.6 points on the shuffled store; a floor is only safe well under the budget it sits under.

The orders as given. Two arrival orders, shuffled and a cluster at a time. A store that arrives partly clustered would want something between the two fitted divisions at half a bit, and no rule here is fitted to it.

Two seeds and one store. As before: one seed of queries to choose on and one to charge on, and one store of 2202^{20} keys.

Still open: a rule that reads a level’s span

At half a bit a key the two orders want opposite divisions because their levels differ in one thing the sizes do not show: how much of the key space each level spans. A level filled a cluster at a time spans a few clusters and is ruled out by its fences for most range queries; a shuffled level spans everything and is ruled out by nothing. A store knows each level’s key span when it writes the level, at no cost, since a level’s first and last keys are its fences.

The measurement that follows gives the rule a second input: each level’s bits are scaled by the share of the key space its fences span, before the snap and the floor, so that a level most queries skip is given fewer bits and one every query reaches is given more. The prediction is that at half a bit a key this rule matches the fitted division within five points at every checkpoint on both orders, where the floored rule loses 35 on one and the unfloored rule 26 on the other, and that at a bit and above it changes nothing, since every level’s span is the whole key space on the shuffled store and the floor already decides the clustered one. It could fail on the clustered store’s deepest level, which spans every cluster once the fill is complete and so looks shuffled to a span, at exactly the checkpoint where the fitted division gives it nothing. The question is whether what separates the two stores is something a level can measure about itself, or only something the queries reveal.

Named alongside this one

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

The objects this essay names

Each one links to every other essay that touches it.

Bloom filterDesign parameterLsm treePer levelPredictionSpace accounting