What a bound is

A background that holds two bands

A file kept in six fixed parts by keys, with the part holding the band of hot queries cut in four, ties the nine-part square-root law on drifting traffic and loses to it by 10% to 16% when the band jumps, because after a jump it pays for a whole background part for three hundred queries before moving its split. Asking every part whether a split would pay, instead of asking which part holds the most queries, was proposed to end the wait. It changes nothing: 363 transfers a query against 365. What ends the wait is the second half of the proposal, letting two parts be split at once in three and two pieces: on jumps the background comes within 2% to 4% of the law, and on fast drift, which nobody expected it to touch, it beats the law by 6% to 10%, because a band lying across a background cut is held by two split parts rather than by one split and one whole.

The two parts the law was not given built a partition that does not move. A file of four million keys answers selection queries that fall, nine times in ten, in a band 2% of the ranks wide, and the band drifts or jumps. The file is kept in parts because a file written once for the queries after found that a selection reading only its own part, rather than the whole file, is what makes later queries cheap, and what a pass costs when it is a file is why the unit of every cost here is a block transfer. The square-root law, which parts cut where the questions are found by cutting where the questions fall rather than where the keys do, keeps the file in parts sized so that each part’s share of the keys times its share of the queries is the same, and moves almost every cut whenever the band moves. The fixed background instead cuts the file once into six parts by keys and cuts only the part holding the band, in four, by the law over that part alone. Nine parts on disk either way. On drifting traffic the background tied the nine-part law for a quarter of the rewriting. On jumping traffic it lost by 10% to 16% at every rate.

That page found the loss in one place. After a jump the background went on paying for the band at the cost of a whole background part, over a thousand transfers a query, for about three hundred queries — roughly one half-life of the decayed density it reads — before it moved its split to the band’s new part. The law followed in about a hundred and fifty. Its closing section named the cause as the question the background asks: which part holds the most decayed density. A majority is slow to change hands, and the old part keeps it until the old queries have decayed below the new ones. The proposal asked a different question of every part — whether its recent density would pay for splitting it — and allowed the background to hold two split parts at once, the old band’s and the new one’s, at the same nine parts, by cutting each into fewer pieces while two are split. It predicted that the cost after a jump falls to the law’s within a hundred and fifty queries, that on jumps the background comes within 5% of the law, and that on drift nothing changes, since a drifting band rarely needs two splits.

Two ideas, measured apart

The proposal holds two ideas, and the measurement separates them. Both new designs keep the earlier page’s six parts by keys and its rule for when to recut: a recut is made when the saving it promises, over the half-life of 250 queries, exceeds the price of rewriting the parts it changes. The difference is in which recut they propose when the rule is asked.

The earlier page’s design proposes cutting in four whichever background part holds the most decayed query density. The paying part design asks every part instead: for each of the six, what would the partition cost with that part cut in four, and how much would the rewrite cost, and it proposes the one whose saving most exceeds its price. That is the first idea, and it alone answers the question the earlier page blamed. The two-split design asks the same question of a larger menu. Besides the six single splits it considers every ordered pair of parts, the first cut in three and the second in two, still nine parts in all, and proposes whichever of the thirty-six configurations pays most. That is both ideas together.

The law in nine parts is the yardstick, as before. Every design here is a choice about memory between queries, which is where this account of passes began: the pass that was never a parameter turned the streaming model’s one pass into a dial, and a partition kept between queries is that dial taken to its end, a pass paid once and kept. Streams, charges, seeds and the check every hundred queries are the earlier page’s.

On jumps the second idea does the work

Allowed to split two parts at once, the six-part background follows a jumping band to within 2% to 4% of the nine-part law, where splitting one part left it 10% to 16% behind; choosing that one part by what its split pays instead of by majority changes nothing — 363 against 365 at a jump every 2,500Transfers a query, writes included, four seeds, against the mean number of queries between jumps of the band. The law, 9 parts: 1000 400, 2500 326, 5000 270, 10000 257. 6 by keys, majority's part in 4: 1000 465, 2500 365, 5000 302, 10000 283. 6 by keys, paying part in 4: 1000 465, 2500 363, 5000 302, 10000 283. 6 by keys, two parts split: 1000 407, 2500 333, 5000 277, 10000 267.300400queries between jumps of the band, on averagetransfers a query, writes included1,0002,5005,00010,0006 by keys, majority's part in 46 by keys, paying part in 46 by keys, two parts splitthe law, 9 partsa half-life of 250, changed parts chargeda band that jumps
Fig. 1 Transfers a query, writes included, against the mean number of queries between jumps of the band, four seeds. The law in nine parts: 400, 326, 270, 257 at a jump every 1,000, 2,500, 5,000 and 10,000 queries. Six by keys, majority’s part in four: 465, 365, 302, 283. Paying part in four: 465, 363, 302, 283. Two parts split: 407, 333, 277, 267.

Allowed to split two parts at once, the background follows a jumping band to within 2% to 4% of the nine-part law — 333 transfers a query against 326 at a jump every 2,500 queries — where splitting one part left it 10% to 16% behind. The prediction of within 5% holds at every rate. The first idea, alone, does nothing: choosing the single part by what its split pays costs 363 at a jump every 2,500 against the majority rule’s 365, and the same to the transfer at the other three rates.

That the paying part ties the majority is the measurement’s first surprise, and it relocates the earlier page’s diagnosis. The two rules make nearly the same recuts — 34 and 33 a stream at a jump every thousand queries, 23 and 24 at every 2,500 — and pay the same for them, so after a jump they move the split at nearly the same moment. The wait was never in the choice of question. It was in the answer the rule could give. A single-split design that moves its split to the new band’s part must give up the split on the old band’s, and for a while after the jump the old part still carries most of the decayed queries. A split moved early would pay for the new band and charge the old band’s queries a whole background part. The saving does not exceed the rewrite until the old queries have decayed, about a half-life later, whichever question is asked.

A design that may hold two splits does not face that trade. It can split the new band’s part while the old one is still split, and the saving from the first stretch of new queries is large enough, alone, to pay for rewriting one part.

How quickly it follows

After a jump the two-split background is out of the worst within a hundred queries — 854 transfers a query against the one-split background's 1,190 — and level with the law by about four hundred, not by the hundred and fifty predicted; from 650 queries on it pays 271, more than the one-split background's 230, because it keeps the old band's split until dropping it paysTransfers a query in each stretch of 50 queries after a jump of the band, averaged over the 19 jumps in four seeds at a jump every 2,500 queries that were followed by 1,000 queries without another. The law, 9 parts: 50 1,095, 100 685, 150 429, 200 405, 250 360, 300 369, 350 349, 400 325, 450 310, 500 336, 550 319, 600 313, 650 301, 700 254, 750 262, 800 256, 850 254, 900 254, 950 239, 1000 210. 6 by keys, majority's part in 4: 50 1,249, 100 1,190, 150 1,130, 200 1,104, 250 1,045, 300 626, 350 257, 400 240, 450 254, 500 266, 550 252, 600 256, 650 255, 700 224, 750 239, 800 238, 850 240, 900 225, 950 221, 1000 196. 6 by keys, two parts split: 50 1,167, 100 854, 150 549, 200 540, 250 464, 300 446, 350 390, 400 316, 450 319, 500 338, 550 323, 600 318, 650 324, 700 279, 750 295, 800 298, 850 274, 900 251, 950 243, 1000 205.02505007501,0001,250queries since the band jumpedtransfers a query1002505007501,000the law, 9 parts6 by keys, two parts split6 by keys, majority's part in 4a half-life of 250a jump every 2,500 queries
Fig. 2 Transfers a query in each stretch of fifty queries after a jump, averaged over the nineteen jumps in four seeds at a jump every 2,500 queries that were followed by a thousand queries without another. At 100 queries: the law 685, the one-split background 1,190, the two-split design 854. At 150: 429, 1,130, 549. At 400: 325, 240, 316.

After a jump the two-split design is out of the worst within a hundred queries — 854 transfers a query against the one-split background’s 1,190 — and level with the law by about four hundred, not by the hundred and fifty predicted. At 150 queries it pays 549 against the law’s 429. The prediction counted the time to move a split. It did not count how good a split made early can be.

Its first split of the new band’s part is made on the first hundred or so queries since the jump, and the decayed density at that moment still describes mostly the old band. The new part is cut in two, by the law over its own stretch of a density that has only a few dozen new queries in it, so the cut lands roughly near the band rather than tightly around it. The design recuts again as the new density builds, and again, which is why its curve descends in steps where the law’s falls smoothly. The law has the same problem with a thin density and solves it by moving every cut every time, which the earlier pages priced at nine tenths of the file a recut.

From 650 queries after the jump on, the two-split design pays 271 a query where the one-split background pays 230. That is the other side of the same habit. It keeps the old band’s split in three pieces and the new band’s in two until a recut back to one split in four pays for its rewrite. With a half-life of 250 that takes several half-lives once the old band’s queries are nearly gone, because by then the saving from cutting the new band in four instead of two is small. It is the only stretch on any plate where the two-split design is worse than the design it replaces, and over a stream it is outweighed by the first three hundred queries.

One recut, drawn

109 queries after the band jumps from the 20th percentile to the 35th, the two-split background splits the new band's part in two and keeps the old band's split, cut now in three rather than four, rewriting 2,730 transfers' worth of parts where moving the one split would have meant giving up the old band before its queries had goneThe nine parts of the two-split design on one seed at a jump every 2,500 queries, before and after the recut at query 3300; the band jumped at query 3191 from a centre at 20.0% of the ranks to 34.9%. Before the recut: 0.0–16.7%, 16.7–19.3%, 19.3–20.1%, 20.1–21.0%, 21.0–33.3%, 33.3–50.0%, 50.0–66.7%, 66.7–83.3%, 83.3–100.0%. 109 queries after the jump: 0.0–16.7%, 16.7–19.6%, 19.6–20.9%, 20.9–33.3%, 33.3–35.8%, 35.8–50.0%, 50.0–66.7%, 66.7–83.3%, 83.3–100.0%.old bandnew bandbefore the recut109 queries after the jump0%25%50%75%100%rank in the file · dark: parts under a tenth of the file2^22 keys, blocks of 1,024one seed
Fig. 3 One seed at a jump every 2,500 queries: the nine parts before and after the recut at query 3,300, 109 queries after the band jumped from the 20th percentile to the 35th. Before, the part from 16.7% to 33.3% is cut in four around the old band. After, it is cut in three, and the part from 33.3% to 50% is cut in two at 35.8%.

A hundred and nine queries after the band jumps from the 20th percentile to the 35th, the two-split design cuts the new band’s part in two and keeps the old band’s part split, now in three pieces rather than four. The rewrite costs 2,730 transfers: the old part’s three new pieces and the new part’s two, a third of the file. The four other background parts are not touched.

The new cut at 35.8% puts nearly all of the band, which runs from about 33.9% to 35.9%, into a piece of 2.5% of the file, the first sixth of the new background part. The old band’s part keeps a piece around the 20th percentile of 1.3% of the file where it had a piece of 0.9%. Both bands are held in small parts, the new one about as well as the old one had been, and it is that second small part, the one the single-split design would have had to give up to make the first, which the old band’s last queries are using.

On drift, where nothing was expected

On a drifting band the two-split background beats the nine-part law once the band moves a tenth of a percentile every hundred queries or faster — 302 against 322 at 0.1 and 486 against 537 at 0.5 — a gain nobody predicted, from the stretches where the band lies across a background cutTransfers a query, writes included, four seeds, against the band's drift every 100 queries. The law, 9 parts: 0.02 265, 0.05 280, 0.1 322, 0.2 393, 0.5 537. 6 by keys, majority's part in 4: 0.02 264, 0.05 278, 0.1 329, 0.2 386, 0.5 522. 6 by keys, two parts split: 0.02 264, 0.05 278, 0.1 302, 0.2 361, 0.5 486.300400500how far the band drifts every 100 queries, in percentilestransfers a query, writes included0.020.050.10.20.5the law, 9 parts6 by keys, majority's part in 46 by keys, two parts splita half-life of 250, changed parts chargeda band that drifts
Fig. 4 Transfers a query, writes included, against the band’s drift every 100 queries, four seeds. The law in nine parts: 265, 280, 322, 393, 537 at drifts of 0.02, 0.05, 0.1, 0.2 and 0.5. Six by keys, majority’s part in four: 264, 278, 329, 386, 522. Two parts split: 264, 278, 302, 361, 486.

On a drifting band the two-split design beats the nine-part law once the band moves a tenth of a percentile every hundred queries or faster: 302 transfers a query against 322 at 0.1, 361 against 393 at 0.2, 486 against 537 at 0.5. The prediction said drift would change nothing, and at the two slowest speeds it changes nothing: the two-split design is the one-split background to the transfer. At the three fastest it is 6% to 10% cheaper than the law and 6% to 8% cheaper than the background it extends.

The earlier page found the fixed background’s one weakness on drift, and it is where this gain comes from. A drifting band crosses the fixed background’s cuts, and while it lies across one, half its queries fall in a part that is not split for them. On one stream that page drew, four blocks of the band straddling a cut at twice the law’s cost nearly erased the background’s lead. A design that can split two parts splits both sides of the cut.

The drift gain is the band lying across a background cut, a tenth of the time: at 0.1 the one-split background pays 541 transfers a query in those stretches and 295 elsewhere, and the two-split design 248 and 297 — under the law's 291 when the band straddles, level with it when it does notTransfers a query for the queries alone, writes excluded, in the blocks of 500 queries where the band's 2% stretch contains a background cut of the six-part design and in the rest, four seeds of a drifting band; the band straddles in 10% of blocks. Drift 0.1: the law, 9 parts 291 straddling, 301 inside; 6 by keys, majority's part in 4 541 straddling, 295 inside; 6 by keys, two parts split 248 straddling, 297 inside. Drift 0.2: the law, 9 parts 379 straddling, 357 inside; 6 by keys, majority's part in 4 642 straddling, 345 inside; 6 by keys, two parts split 302 straddling, 353 inside. Drift 0.5: the law, 9 parts 489 straddling, 481 inside; 6 by keys, majority's part in 4 766 straddling, 482 inside; 6 by keys, two parts split 418 straddling, 477 inside.0200400600800drift 0.1the law, 9 parts291 / 3016 by keys, majority's part in 4541 / 2956 by keys, two parts split248 / 297drift 0.2the law, 9 parts379 / 3576 by keys, majority's part in 4642 / 3456 by keys, two parts split302 / 353drift 0.5the law, 9 parts489 / 4816 by keys, majority's part in 4766 / 4826 by keys, two parts split418 / 477upper bar: band across a background cut · lower bar: inside one parttransfers a query, queries onlyblocks of 500 queries, four seedsa band that drifts
Fig. 5 Transfers a query for the queries alone, in the blocks of 500 queries where the band’s stretch contains a background cut and in the rest, four seeds of a drifting band; the band straddles in a tenth of the blocks. At 0.1: the law 291 straddling and 301 inside, the one-split background 541 and 295, the two-split design 248 and 297.

Where the band lies across a background cut, the one-split background pays 541 transfers a query at a drift of 0.1 and the two-split design 248 — less than the law’s 291 in the same stretches; where the band lies inside one part, all three pay within six transfers of each other at that speed, and within twelve at the faster ones. The band straddles in a tenth of the blocks at every speed, and that tenth carries the whole difference. Inside a part the three designs are doing the same thing: a small piece around the band and large pieces elsewhere. Across a cut the one-split background holds half the band in a whole sixth of the file. The two-split design holds each half in a small piece of its own part.

That the two-split design beats the law across a cut, and not only the one-split background, is a property of the law’s own geometry. The law must place all its cuts by one rule over the whole file, and the band’s piece is one of nine. The two-split design spends two of its pieces on the two halves of a band that a fixed cut divides, and its pieces there can be smaller than the law’s single one. It is a small advantage over a tenth of the stream, and at the fastest drift it is the difference between the two designs.

How often two are split, and what they cost to write

Half the two-split design's recuts on jumping traffic leave two parts split — 63% at a jump every 1,000 to 44% at 10,000 — and on drift the share rises with speed, 0% at 0.02 to 24% at 0.5, the fast drifts where a band lies across a background cut most oftenFor the two-split design, the share of its recuts that leave two background parts split, and its recuts in all, four seeds. Jump every 1,000: 63% of 53 recuts; Jump every 2,500: 48% of 34 recuts; Jump every 5,000: 51% of 16 recuts; Jump every 10,000: 44% of 16 recuts; Drift 0.02: 0% of 66 recuts; Drift 0.05: 0% of 84 recuts; Drift 0.1: 7% of 126 recuts; Drift 0.2: 13% of 163 recuts; Drift 0.5: 24% of 179 recuts.0%25%50%75%100%jump every 1,00053 recutsjump every 2,50034 recutsjump every 5,00016 recutsjump every 10,00016 recutsdrift 0.0266 recutsdrift 0.0584 recutsdrift 0.1126 recutsdrift 0.2163 recutsdrift 0.5179 recutsshare of recuts that leave two parts splittwo-split design, four seedsper recut
Fig. 6 For the two-split design, the share of its recuts that leave two background parts split. Jumps every 1,000, 2,500, 5,000 and 10,000 queries: 63%, 48%, 51%, 44%. Drifts of 0.02, 0.05, 0.1, 0.2, 0.5: 0%, 0%, 7%, 13%, 24%.

About half the two-split design’s recuts on jumping traffic leave two parts split, and on drift the share rises with speed, from none at 0.05 to a quarter at 0.5. On jumping traffic most of those are the moments the drawn recut shows, the new band split while the old one fades. On drift they are straddles. Why their share rises with speed is not settled by these streams: the share of blocks in which the band straddles a cut stays at a tenth at every speed, and what changes is how many recuts the design makes — 84 at 0.05 and 179 at 0.5 — and how many of those land while the band is across a cut.

At a jump every 2,500 queries the two-split design pays about twice the one-split background's writes, 3.9 transfers a query against 2.3, for 33 fewer in its queries; the law pays 10.1 in writes because each recut moves cuts everywhereTransfers a query at a jump every 2,500 queries, four seeds, split into the queries' own transfers and the rewriting. The law, 9 parts: 316 in queries, 10 in writes, 24 recuts. 6 by keys, majority's part in 4: 363 in queries, 2 in writes, 24 recuts. 6 by keys, paying part in 4: 361 in queries, 2 in writes, 23 recuts. 6 by keys, two parts split: 329 in queries, 4 in writes, 34 recuts.0100200300400the law, 9 parts3266 by keys, majority's part in 43656 by keys, paying part in 43636 by keys, two parts split333transfers a query · pale: the queries · coloured: rewritinga jump every 2,500 queriesqueries and writes
Fig. 7 Transfers a query at a jump every 2,500 queries, split into the queries’ own transfers and the rewriting. The law: 316 and 10. The one-split background: 363 and 2. The paying part: 361 and 2. The two-split design: 329 and 4, with 34 recuts against 24.

At a jump every 2,500 queries the two-split design pays about twice the one-split background’s rewriting, four transfers a query against two, for 34 fewer in its queries. It recuts 34 times in a stream where the background recuts 24, because following a jump now takes several recuts — the early split, the improved one, the eventual return to one split — and each rewrites a third of the file or less. The law rewrites ten transfers a query, because each of its recuts moves cuts everywhere. The two-split design’s writes are still under half the law’s. It recovers the law’s following without the law’s habit of moving the background, which was the point of the background, and every cut the law moves measured what that habit costs.

What the proposal got right, and why

The proposal had the right remedy and the wrong reason for it. The earlier page diagnosed a rule that asked a slow question, and the paying-part design shows the question was not slow, or rather that any question a one-split design can ask has the same answer at the same time. What made the background slow was a constraint: one split. A partition with a fixed background and one split part is forced to choose between the band that is leaving and the band that has arrived, and while the leaving band still carries most of the recent queries, it chooses wrongly for a reason that is right on the evidence it has. Allowing two splits removes the choice.

The same diagnosis explains the drift gain. A band across a background cut is the drifting version of a band that has jumped — two parts each holding half the hot queries — and a one-split design makes the same forced choice there, every time the band crosses one of five fixed lines. The two-split design was proposed for jumps and finds its largest advantage over the law on drift, because drift makes the forced choice more often.

A recut the law decides found the law’s rule — recut when the saving over a half-life exceeds the price — the right rule for when. These measurements say something about which: a design that can only make expensive recuts must wait to make them, and a design given cheap partial ones, a part’s worth rather than a file’s, can make them early and correct them later. The two-split design recuts more often than the background it extends, writes twice as much, and is cheaper on every stream except the slowest, where it is the same.

What these streams leave out

One shape of band. Every stream has one band, 2% wide, carrying nine tenths of the queries. A workload with two bands at once, steadily, is what the two-split design is built for and was not run; the jumping streams give it two bands only briefly.

Nine parts, divided one way. The count of nine is the law’s seven plus the two that the two parts the law was not given found a fixed background needed before the comparison stopped being bought with parts. The two-split design divides its three extra parts as three and two between the two bands. A division of two and two with the remaining part kept for the background, or one weighted by the bands’ densities, would place the cuts differently. Only one division was run.

One half-life. The decayed density’s half-life is 250 queries throughout, as on the earlier pages. A shorter half-life would make every design follow sooner and each first split cruder; the late cost of keeping two splits is set by it too.

Still open: a background that lets go of the old band sooner

The two-split design’s one weakness on these plates is late: from 650 queries after a jump it pays about forty transfers a query more than the one-split background, because it keeps the old band’s part split in three until merging it back pays for the rewrite, and by then the saving from cutting the new band in four rather than two is small. The rule for when to recut is the law’s, and it prices only the saving over the next half-life.

A design could drop the old band’s split as soon as the old part’s decayed density falls below a share of the new part’s — releasing its pieces to the new band without waiting for the saving to exceed the rewrite. The measurement that follows gives the two-split design that rule, with the share swept from a quarter to a twentieth, and measures cost after a jump, on every jump rate and on drift. The prediction is that at a share of a tenth the late cost falls to the one-split background’s, about 230 a query, without giving back the early gain, and the jump costs come within 1% of the law. It could fail on drift: there the two splits are a straddle, not an old band and a new one, and the half of a straddling band in the emptier part may fall below a tenth of the other half for a moment and lose its split exactly while it is still being queried. The question is whether one rule can tell a band that is leaving from half a band that is still there, or whether the price-over-a-half-life rule is slow on jumps because it is right on drift.

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.

Block transferExternal-memoryPartitionPredictionSelectionTrade offWorkload