How to multi insert rows in cassandra

前端 未结 5 2332
北海茫月
北海茫月 2021-02-18 23:29

What is the most efficient way of inserting multiple rows in cassandra column family. Is it possible to do this in a single call.

Right now my approach is to addinsert m

5条回答
  •  野性不改
    2021-02-19 00:17

    There is a batch insert operation in Cassandra. You can batch together inserts, even in different column families, to make insertion more efficient.

    In Hector, you can use HFactory.createMutator then use the add methods on the returned Mutator to add operations to your batch. When ready, call execute().

    If you're using CQL, then you group things into a batch by starting the batch with BEGIN BATCH and ending with APPLY BATCH.

提交回复
热议问题