Cassandra handles this by using a different design, you don't append
anything.  You use the fact that in Cassandra you have dynamic columns
and you make a new column every time you want to put more data in.  Then
when you do finally need to read the data out you read out a slice of
columns, not just one column.

-Jeremiah

-----Original Message-----
From: Marcus Bointon [mailto:mar...@synchromedia.co.uk] 
Sent: Tuesday, May 31, 2011 2:23 PM
To: user@cassandra.apache.org
Subject: Appending to fields

I'm wondering how cassandra implements appending values to fields. Since
(so the docs tell me) there's not really any such thing such thing as an
update in Cassandra, I wonder if it falls into the same trap as MySQL
does. With a query like "update x set y = concat(y, 'a') where id = 1",
mysql reads the entire value of y, appends the data, then writes the
whole thing back, which unfortunately is an O(n^2) operation. The
situation I'm doing this in involves what amount to log files on
hundreds of thousands of items, many of which might need updating at
once, so they're all simple appends, but it becomes unusably slow very
quickly. In MySQL it's just a plain bug as it could optimise this by
appending data at a known offset and then bumping up the field length
counter, which is back in at least O(n) territory. Does cassandra's
design avoid this problem?

Marcus

Reply via email to