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
(seconds):

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.

Why!?

My code snippet (using cql-rb) is available here:
http://pastebin.com/qAcRcqbF

Thanks,
Przemek

Reply via email to