Need of Bloom Filter in databases such as Cassandra

Viewed 91

I know that a bloom filter tells you if a particular key is present in a SSTable probabilistically. I also know that there are indexes to help find which SSTables has a key. My question is: Why do we need bloom filters in the first place? Why can't we just do away with the indexes since both of them seem to be doing almost the same job and also since indexes will give out a deterministic answer compared to bloom filters?

1 Answers

Indexes are generated for each of the SSTable, so we'll need to read an index for each SSTable to determine the position of the partition, etc. - this is performance overhead that is prevented by the bloom filter, that allows to skip reading of the SSTable if data is not in specific SSTable. Lookup via bloom filter is much faster than reading of the index from disk.

Related