Bloom filters for membership 00:00:01 Fit membership into eight bits Starting with a blank eight-bit Bloom filter, all positions are zero—no keys have been added yet, so every lookup will return no. Insert key A. Its hash positions are one and four. Light those two positions and leave the other six dark. Testing A will consult the same two positions. The two lights are all the filter remembers about A. It never stores the original key. Another key might require some or all of those same bits. Index these positions from zero on the left through seven on the right. The demonstration uses two invented hash outputs for each named key so we can inspect every single bit without needing to calculate a real hash. 00:00:42 A second key shares a bit Now B selects positions four and six. Four was already on. Turn on six. The lit positions, in increasing order, are one, four and six. Position four is shared between A and B. The bit alone offers no evidence about the number or identities of the keys that selected it. Consider C before looking up its history. Its positions are one and six. What will this filter report if both were lit by other keys? The filter forgot which key set position four first. It stores evidence accumulated from all insertions, and a second write of a one to a one leaves no trace of how many writers shared it. 00:01:25 Ask about C before looking it up Key C maps to positions one and six, both already set, so the filter says maybe, even though C was never inserted. The exact key set contains only A and B. C was never inserted. It happened to borrow one previously set bit from each insertion, so this is a false positive. If C is a lookup for a stored record, treat the positive as permission to check exact storage, not as proof that the record exists. The server can avoid some reads for absent entries. It still needs an exact source when a positive would authorize something important. A filter designed to save cache traffic should never silently become an access-control list. 00:02:07 Read an absent key and try deletion If a query hits a zero bit, the key is definitely not in the set under normal insertion-only rules. Clearing bit four to delete A would also erase B’s evidence, making B look absent even though it’s not. A standard Bloom filter cannot safely delete keys without risking false negatives. For deletions a counting variant can use counters and a supported removal protocol, or a service can rebuild from its current exact set. A counting filter also needs correct duplicate handling and counter limits. 00:02:40 Spend memory according to mistakes As more keys are added, more bits turn on, raising the false positive rate with each insertion. Eight bits and two hash selections are for our tiny demonstration. In production, size a filter from expected distinct insertions and an acceptable false-positive rate. Monitor the realized load. Use it as a gate. At least one clear bit can rule an item out of this complete insertion-only set. All required bits lit means the exact store may still need to decide. Check whether a negative reflects the whole data set or merely yesterday’s snapshot. If insertions have not reached a replica, a real item may be absent from that replica’s filter despite perfectly functioning hashes.