Rafael Rocha
Rafael Rocha

Reputation: 27

Using intensive update in Map type column in Cassandra is anti-pattern?

Friends,

I am modeling a table in Cassandra which contains a Map column. So this Map should contains dynamic values and will be update so much for that row (I will update by a Primary Key)

Is it an anti-patterns, which other options should I consider ?

Upvotes: 1

Views: 203

Answers (1)

Carlo Bertuccini
Carlo Bertuccini

Reputation: 20051

What you're trying to do is possibly what I described here.

First big limitations that comes into my mind are the one given by the specification:

  • 64KB is the max size of an item in a collection
  • 65536 is the max number of queryable elements inside a collection

More there are the problems described in other post

  1. you can not retrieve part of a collection: even if internally each entry of a map is stored as a column you can only retrieve the whole collection (this can lead to very slow performances)
  2. you have to choose whether creating an index on keys or on values, both simultaneously are not supported.
  3. Since maps are typed you can't put mixed values inside: you have to represent everything as a string or bytes and then transform your data client side

I personally consider this approach as an anti pattern for all these reasons -- this approach provide a schema less solution but reduce performances and introduce lots of limitations like the one secondary indexes and typing.

HTH, Carlo

Upvotes: 1

Related Questions