Skip to download

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 columns

JSON 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.

Three assumed runs: 10,000, 100,000 and 1,000,000 entries. One row per case here; three rows per case in CSV.
Budget, bits/entryPolicyTotal filter bitsExpected probes / absent query
0equal03.000000
0optimized03.000000
1equal1,110,0001.855509
1optimized1,110,0000.880588
2equal2,220,0001.147638
2optimized2,220,0000.544647
4equal4,440,0000.439025
4optimized4,440,0000.208352
8equal8,880,0000.064248
8optimized8,880,0000.030491
10equal11,100,0000.024578
10optimized11,100,0000.011664
12equal13,320,0000.009402
12optimized13,320,0000.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

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.

  1. Bose et al. On the false-positive rate of Bloom filters. Author manuscript, section 2: condition on occupied bits before averaging.
  2. Apache Parquet. Bloom Filter, Technical Approach: eight 32-bit words and shared-input salted masks.
  3. 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.
  4. 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.
  5. 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/