nosqlcassandrathrifthectorpelops

Cassandra: copy entire row


Is there a recommended way, using a Java client, to copy / clone a row in a Cassandra column family?

I'm currently using Hector (1.0-2) with Cassandra 1.1.8 but switching to another client library shouldn't be a problem.


Solution

  • Nope, get all rows by sending a list of keys(happens in parallel on the disks so i/o is faster that way). loop through all rows in memory(which is real fast anyways) and do one write operation writing all rows back to the disks.(again, the write is done on all disks in parallel so disk write is fast).

    The i/o is what you need to worry about anyways as the in-memory ops are fast typically. If you are doing A HUGE amount of copying, you need to switch to map/reduce instead.

    If you are using PlayOrm on cassandra, just write a copy method on the entity you are copying to keep your code clean.