Is CockroachDB well suited for storing many many small rows? What's the per-row bytes overhead?


How large is the bytes-per-row overhead in CockroachDB?

(In PostgreSQL, for example, it seems to be about 20-30 bytes per row, see )

I’m looking to store many many fairly small rows; then per-row overhead matters fairly much, I would think.

I was thinking about using RocksDB via Facebook’s MyRocks database (MyRocks is a MySQL fork with RocksDB as a storage engine), because RocksDB compresses data really well as far as I’ve read. However now I found out that CockroachDB also uses RocksDB as its underlying storage, and I’m wondering if perhaps I might as well use CockroachDB as MyRocks? (I have in mind perhaps using CockroachDB later for other stuff anyway.)

This CockroachDB documentation seems to suggest that CockroachDB uses as little disk as RocksDB does:

Key	            Value
/1000/10/2      4.5
/1000/10/3      "hello”

[You might be thinking that the common prefixes (/1000/10) for the keys are wasting storage, but RocksDB our underlying storage engine, eliminates almost all of the overhead via prefix compression of keys.]

… but perhaps there’s more things going on that I don’t know about, that makes CockroachDB use more space in comparison to MyRocks or plain-RocksDB?

Thanks for reading & regards,

Every key also has a timestamp suffix which consumes 9-13 bytes (usually 9).

Hi Peter, thanks, this gives me the impression then that CockroachDB something like in the middle between a pure RocksDB, and a PostgreSQL database, storage wise (+ replicas). Marking as solved … (by clicking the [v] checkbox)