Computed examples / not database measurements
Bloom filter allocation: equal memory, different lookup cost
Fourteen deterministic cases compare equal bits per entry with optimized allocation across three invented runs. Expected probes, not measured latency.
Download CSV42 rows / 10 columnsJSON and provenance / Evaluator code / Research explanation
Method
Assume every absent point lookup considers every run, all filter/index metadata is resident, and each false positive costs one equally weighted probe. Use p=exp(-b*ln(2)^2). Minimize sum(p_i) subject to sum(n_i*b_i)=budget and b_i>=0 using KKT conditions and 100-step bounded bisection. Run sizes: 10000, 100000, 1000000 entries. Average budgets: 0, 1, 2, 4, 8, 10, 12 bits per stored entry. No random sample or device I/O.
| Budget, bits/entry | Policy | Total filter bits | Expected probes / absent query |
|---|---|---|---|
| 0 | equal | 0 | 3.000000 |
| 0 | optimized | 0 | 3.000000 |
| 1 | equal | 1,110,000 | 1.855509 |
| 1 | optimized | 1,110,000 | 0.880588 |
| 2 | equal | 2,220,000 | 1.147638 |
| 2 | optimized | 2,220,000 | 0.544647 |
| 4 | equal | 4,440,000 | 0.439025 |
| 4 | optimized | 4,440,000 | 0.208352 |
| 8 | equal | 8,880,000 | 0.064248 |
| 8 | optimized | 8,880,000 | 0.030491 |
| 10 | equal | 11,100,000 | 0.024578 |
| 10 | optimized | 11,100,000 | 0.011664 |
| 12 | equal | 13,320,000 | 0.009402 |
| 12 | optimized | 13,320,000 | 0.004462 |
Interpretation
Expected probes can be below one or above one. They are a sum of probabilities, not the probability of at least one false positive, and not milliseconds. The three copies of expectedProbes in each CSV case must not be added together.
Reproduce
The standalone module requires Node.js and no packages. The command performs no storage benchmark. The API accepts 1-64 positive-integer run sizes and an average budget of zero or 0.000001-64 bits per entry. JSON records code and CSV SHA-256 hashes; regeneration updates the generation timestamp, not the computed rows.
node --input-type=module -e 'import { toCsv } from "./bloom-allocation.mjs"; process.stdout.write(toCsv())'Limits
- Invented run sizes and deterministic arithmetic, not a measured database population.
- Continuous ideal approximation with optimal hash count, not exact finite Bloom-filter probabilities.
- Only absent point queries: no successful-query early exit, ranges, cache misses, CPU or compaction cost.
- No L0 overlap or key-range pruning model; no claimed RocksDB setting or latency improvement.
- Zero bits means the run is always probed, not that an empty Bloom filter rejects all keys.
- No confidence interval applies to these computed examples; model applicability remains uncertain.
- This is not a replication of Monkey's implementation, experimental workloads or full design-space optimizer.
Finite probabilities: companion calculation
The allocation rows above remain unchanged: they use a continuous ideal approximation. A separate JSON receipt provides five finite-filter cases, a three-way block-layout comparison and four chosen occupancy/query-weight cases. These are computed probabilities, not sampled frequencies or database measurements.
For independent uniform addresses with replacement, the evaluator tracks occupied-bit counts after every insertion address, then averages the conditional false-positive probability. The blocked model assigns each distinct key to one uniform block before drawing its addresses. It is not Parquet's split-block algorithm. See the derivation and interpretation.
The same fill can describe different query geometry
Choosing one block is not the same as choosing one bit in each word. In an ideal two-word filter with four bits per word and independent uniform query addresses, occupancies of one and three bits give a false-positive probability of 3/16; two and two give 1/4. Both states occupy four of eight bits and are reachable after three insertions. Aggregate fill squared gives 1/4 for both, losing the word-level information. These are constructed conditional states, not device measurements.
For independent query addresses across equal-sized words, multiply their fill fractions. That product cannot exceed the power of their average fill. This is different from averaging over randomly built unpartitioned filters, where Bose et al.'s occupancy analysis requires the average of the fill powers. The two comparisons condition on different information.
Parquet's specification uses eight 32-bit words, with one selected bit per word. Its salted masks share one input, so the independent-word product is not an exact Parquet error-rate formula either. Match both the bit layout and hash construction before applying a model.
Place the evaluator, generator and standalone tests together. Run node generate-bloom-finite.mjs, then node --test bloom-finite.test.mjs. The generator updates the timestamp and runtime, while results remain deterministic.
The exact-rational verifier checks the complete 12-case published packet and all 42 numerical outputs, including the 4096-bit row. It uses exact integer/rational probabilities and occupancy means plus a 60-digit decimal check of the exponential approximation: run python3 verify-bloom-finite.py beside the receipt. Its regression tests compare two exact formulas on 80 small geometries, enumerate the partitioned illustration above, and reject changed values, missing cases, invalid weights and duplicate JSON keys, also under python3 -O.
Verification establishes consistency of this versioned example packet, not correctness of every possible model input, authenticity of the source hash, or performance of a storage engine. Code and computed results are CC0; cited publications retain their own rights.
Column definitions
- policy
- equal: identical bits per entry; optimized: minimum sum of model false-positive probabilities.
- budgetBitsPerEntry
- Total filter budget / total stored entries, bits per entry; not bytes.
- totalEntries
- Sum of entries across the three invented runs, not distinct live database keys.
- budgetBits
- Total ideal filter bit budget, excluding headers, indexes and caches.
- run
- Run number, ascending by entry count; not a RocksDB level identifier.
- entries
- Assumed stored entry count in this run.
- bitsPerEntry
- Continuous ideal filter bits / this run's entries; not rounded hash counts.
- filterBits
- Continuous allocated bits for this run; need not be an integer.
- falsePositiveProbability
- Probability for a key absent from this run under exp(-bitsPerEntry * ln(2)^2); 1 means no filter.
- expectedProbes
- Sum of run false-positive probabilities for one absent point lookup, repeated for each case's three rows.
Sources and license
CC0-1.0 for Hesela's original implementation and computed rows; cited papers and documentation retain their own rights.
- Bose et al. On the false-positive rate of Bloom filters. Author manuscript, section 2: condition on occupied bits before averaging.
- Apache Parquet. Bloom Filter, Technical Approach: eight 32-bit words and shared-input salted masks.
- Burton H. Bloom. Space/time trade-offs in hash coding with allowable errors. Communications of the ACM 13(7), 422-426 (1970), method 2. DOI: 10.1145/362686.362692.
- Niv Dayan, Manos Athanassoulis and Stratos Idreos. Monkey: Optimal Navigable Key-Value Store. SIGMOD 2017, 79-94; sections 2, 4.1 and 5. DOI: 10.1145/3035918.3064054.
- RocksDB project. RocksDB Bloom Filter: statistics, full filters and implementation trade-offs. Documentation reviewed 12 October 2026.
Corpus: Bloom filter, blocked Bloom filter, LSM-tree, SSTable.
Published by Hesela team
Report a correction · Editorial standards · Reuse guidance
Cite this page
Hesela team. Bloom filter allocation: equal memory, different lookup cost. Hesela. https://hesela.dev/datasets/bloom-filter-allocation/