# RocksDB: Column Families

![`smart`](RocksDBColumnFamilies_aa_002_20220511.png)

----------------------------------------------------------------------------
RocksDB is a key-value database that allows users to create and manage multiple logical partitions called column families. Each column family stores a unique set of key-value pairs and can be independently configured and managed. Column families were introduced in RocksDB version 3.0 and provide a way to logically shard a database, allowing for more efficient and flexible management of data.

One of the key features of column families is that they support atomic writes across multiple column families. This means that you can atomically execute a write operation that spans multiple column families, ensuring that either all of the writes are applied or none of them are. This can be useful for applications that need to maintain the consistency of data across multiple column families.

Another important feature of column families is that they provide a consistent view of data across all column families in a database. This means that you can query and access data in any column family, and the data will be consistent and up-to-date.

Column families in RocksDB share a single write-ahead logging (WAL) file, and they do not share MemTable or SSTable files, each column family has its own dedicated MemTable and SSTable files. This allows for atomic writes across column families, while also allowing for independent configuration and management of each column family. When a column family is flushed, a new WAL log file is created, and all writes to all column families are written to this new file. The old WAL log files are not deleted until all column families have been flushed and their data has been written to the new log file. This ensures that all column families are regularly flushed and that data is not lost in the event of a crash or other failure.
