{
  "slug": "prefix-bloom-filter",
  "term": "Prefix Bloom filter",
  "aliases": [
    "Prefix membership filter"
  ],
  "definition": "A Bloom filter built over extracted key prefixes rather than only whole keys, allowing negative membership tests for those represented prefixes.",
  "note": "A present prefix can belong to an absent full key; that is not a false positive for prefix membership. A single negative prefix test cannot prove an interval crossing other prefixes empty. The extractor needs a comparator under which keys that share a prefix sit together in the total order, otherwise a correct negative can still hide a matching key. [prefix-guide]\n\nRocksDB documents total_order_seek as bypassing prefix filtering where supported. Its adaptive mode aims to preserve total-order results, but v9.7.3 documents a short-key omission when the upper bound uses a different prefix. Do not treat that intent as an unconditional guarantee. [prefix-options] Manual prefix mode returns undefined results outside the prefix without an error. A file whose stored extractor name differs from the current one is generally read without its prefix filter. [prefix-guide]\n\nPrefix filters help only queries whose prefix is known in advance. A range-filter evaluation on 128-bit keys made of a 64-bit timestamp and a 64-bit sensor ID left them out, because arbitrary integer ranges had no predetermined prefixes and absent keys sharing a prefix with a present key always pass. [surf]",
  "related": [
    "bloom-filter",
    "prefix-extractor",
    "succinct-range-filter",
    "sstable",
    "slimdb",
    "tablefs",
    "prefix-siphoning"
  ],
  "citations": [
    {
      "id": "prefix-guide",
      "title": "RocksDB project. Prefix Seek: comparator compatibility, iterator modes and extractor changes.",
      "url": "https://github.com/facebook/rocksdb/wiki/Prefix-Seek",
      "accessed": "2026-10-23"
    },
    {
      "id": "hesela",
      "title": "Hesela: prefix order counterexamples and exact-set checks",
      "url": "https://hesela.com/analyses/bloom-filters-lsm-read-cost/#prefix-order",
      "accessed": "2026-10-20"
    },
    {
      "id": "surf",
      "title": "Zhang, Lim, Leis, Andersen, Kaminsky, Keeton and Pavlo. SuRF: Practical Range Query Filtering with Fast Succinct Tries. SIGMOD 2018, sections 1, 6 and 7.",
      "url": "https://www.cs.cmu.edu/~pavlo/papers/mod601-zhangA-hm.pdf",
      "accessed": "2026-10-23"
    },
    {
      "id": "prefix-options",
      "title": "RocksDB v9.7.3 options.h: ReadOptions total_order_seek and auto_prefix_mode short-key BUG.",
      "url": "https://github.com/facebook/rocksdb/blob/v9.7.3/include/rocksdb/options.h#L1692-L1712",
      "accessed": "2026-11-14"
    }
  ],
  "status": "shipping",
  "advantages": [
    {
      "text": "Short iterator queries confined to one prefix can skip sorted runs that hold no entry for it, saving I/O requests and block decompression.",
      "citationIds": [
        "prefix-guide"
      ]
    }
  ],
  "limitations": [
    {
      "text": "Adaptive mode supports only fixed and capped extractors, needs comparator support for an immediate-successor test and spends extra CPU deciding whether each file qualifies.",
      "citationIds": [
        "prefix-guide"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-02",
  "provenance": [
    "prefix-guide re-read 2026-10-23 for comparator compatibility, total-order and adaptive modes, manual-mode misuse and extractor changes.",
    "surf read 2026-10-23, sections 1, 6 and 7, for the 128-bit key layout and the reasons prefix filters were excluded from the evaluation.",
    "The sstable entry links here because prefix filters are stored per table file and are skipped for files built with a different extractor.",
    "A companion analysis on prefix order counterexamples is listed but not used in prose.",
    "2026-11-14: replaced the wiki-derived unconditional adaptive-mode claim with the versioned API caveat; no claim about uninspected newer releases."
  ]
}
