cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Przemek Maciolek <>
Subject Composite keys - terrible write performance issue when using BATCH
Date Wed, 07 Aug 2013 12:43:18 GMT
Hi All,

I found a significant performance problem when using composite primary key,
"wide" row and BATCH.

Ideally, I would like to have following structure:
          CREATE TABLE bar1 (
            some_id bigint,
            some_type text,
            some_value int,
            some_data text,
            PRIMARY KEY((some_id, some_type), some_value)

For each (some_id, some_type) there might be hundreds of thousands columns.
However, storing them gets incredibly slow....

So I played with the structure and used something like that (concatenating
some_type and some_value together) :
          CREATE TABLE bar2 (
            some_id bigint,
            some_type text,
            some_value_and_data text,
            PRIMARY KEY((some_id, some_type))

The speedup was unbelievable. I made some more tests, using BATCH vs
executing each statement separately. 10 000 entries took following time

Using composite keys
Separetely: 12.892867
Batch: 189.731306
Using just partition key and wide row
Separetely: 11.292507
Batch: 0.093355

So using BATCH for composite key was roughly 2000 times slower than it
should be, making it pretty much unusable.


My code snippet (using cql-rb) is available here:


View raw message