- https://medium.com/@_jaydeepkarale/the-bloom-filter-how-big-tech-avoids-expensive-database-lookups-1a109d05bc2f
- Type: article
- Source: Medium · Jaydeep Karale · Dec 2025
TL;DR
A Bloom filter is a compact probabilistic set that answers only “definitely not present” or “maybe present”, so a service can skip the database lookup for a name that is certainly taken. The article uses the “username already taken” flow as its example.
Partial source
Medium cut the body behind the paywall, so only the opening is captured here. The false-positive rate formula and the sizing details are not in this note.
What it covers
- The problem: a service with millions of users cannot query the database for every keystroke and every username variation.
- The trick: a Bloom filter never says a definitive “yes”; a match means the item might be in the set, a miss means it certainly is not, so only possible matches reach the database.
- The trade-off named in the article: it intentionally “lies” with false positives, and the cost of those depends on how the bit array is sized.
Key takeaways
- One-sided certainty. False negatives never happen; false positives do. That is why it fits a pre-check in front of a slower store such as a database.
- Small and fast. Membership is a few hash lookups over a bit array, not an index or a disk read.
- Username check. A popular example: the filter holds taken usernames, so most rejections never touch the database.
When to use
- As a cheap pre-filter in front of a slow or expensive lookup: a miss saves the query, a hit only means “worth checking”.
- When a small, fixed false-positive rate is acceptable, for example “does this username exist” or “have we seen this URL”.
- Not for anything that must be exact, for deletion-heavy sets (the classic filter cannot remove items), or where you need the items themselves and not just membership.