0

I am using java datastax client to insert data into cassandra. Right now I am iterating through list of objects and inserting row by row. There are different amount of rows for each case, but speed is unacceptable for me. Could you please suggest ways of speed improvement? Do you think BATCH insert might help? What about multi-threading insertion?

Thanks for any help!

This is my table.

CREATE TABLE StatisticsKeyspace.HourlyStatistics(
KeywordId text,
Date timestamp,
HourOfDay int,
Impressions int,
Clicks int,
AveragePosition double,
ConversionRate double,
AOV double,
AverageCPC double,
Cost double,
Bid double,
PRIMARY KEY(KeywordId, Date, HourOfDay)
);
CREATE INDEX ON StatisticsKeyspace.HourlyStatistics(Date);
BrianC
  • 10,591
  • 2
  • 30
  • 50
Wild Goat
  • 3,509
  • 12
  • 46
  • 87
  • Yes BATCH should do the work for you. And multi threading also could be another way to achieve fast insertion. But I would recommend to use BATCH insertion. – kkmishra Jun 13 '14 at 09:39
  • @kkmishra, thanks! do you know what is recommended maximum number of statements inside single batch? – Wild Goat Jun 13 '14 at 09:42
  • 1
    I don't know exactly but i have used between 5000 to 10000 statements per batch and worked fine for me. – kkmishra Jun 13 '14 at 09:47
  • @kkmishra, thanks! Do you have an example inserting data in batch? – Wild Goat Jun 13 '14 at 10:17

0 Answers0