In cassandra, you can have wide rows, up to 2B columns per row ... if this is enough for an element of cumulative lists of objects, you can store entire lists of objects on one line and then extract them all together. with the cassandra “composite column” you can store the elements of each list sequentially and sorted, and you can delete one column (list element) whenever you want, and when you have an insert, you just need to insert the column ...
something like that: (!)
|list_1_Id : item1Id |list_1_Id : item2Id | list_2_Id : item1Id |...| list_n_Id : item3Id | entity| item1Value | item2Value | item1Value |...| item3Value |
so practically you are dealing with columns (= elements), not lists ... and this makes your work a lot easier. depends on your list size coordinator, using splitting the entiti line into multiple lines ... something like this: (!)
| item1Id | item2Id | item3Id | item4Id |... entiId_list_1_Id | item1Value | item2Value | item3Value | item4Value |... | item1Id | item2Id | item3Id | item4Id |... entiId_list_2_Id | item1Value | item2Value | item3Value | item4Value |... ...
and you can put itemValue in the column name and leave the column value blank to reduce the size ... for example, you can insert a new element by simply doing: // columns are sorted by their identifier if they have insert into entityList [entityId] [ listId] [itemId] = item value; or // columns are sorted by their value insert into entityList [entityId] [listId] [itemvalue] = nothing; and delete: delete from entityList, where entityId = 'd' and listId = 'o' and itemId = 'n';
or through your application, you can do this using a rich client like Hector ...
source share