You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by "X. F. Li" <li...@gmail.com> on 2016/03/08 11:49:24 UTC

If a cluster column has the same value over many rows, is the value duplicated in memory?

Hi,

If a cluster column has the same value over many rows, is the value 
duplicated in memory?

Suppose we have

   create table t (
     c1 int,
     c2 text,
     c3 int,
     primary key(c1,c2,c3)
   );

and we have N rows with the same value for (c1,c2) and different values 
for c3. When the rows are loaded into memory cache, is the value of c2 
duplicated N times in memory? Or cassandra treat (c1,c2,c3) like a 
multi-level map and only have 1 copy for the value?

Thanks.

X. F. Li

Re: If a cluster column has the same value over many rows, is the value duplicated in memory?

Posted by Carlos Alonso <in...@mrcalonso.com>.
They'll be duplicated. The only way of having one single value per
partition is to declare it as static.

Carlos Alonso | Software Engineer | @calonso <https://twitter.com/calonso>

On 8 March 2016 at 11:49, X. F. Li <li...@gmail.com> wrote:

> Hi,
>
> If a cluster column has the same value over many rows, is the value
> duplicated in memory?
>
> Suppose we have
>
>   create table t (
>     c1 int,
>     c2 text,
>     c3 int,
>     primary key(c1,c2,c3)
>   );
>
> and we have N rows with the same value for (c1,c2) and different values
> for c3. When the rows are loaded into memory cache, is the value of c2
> duplicated N times in memory? Or cassandra treat (c1,c2,c3) like a
> multi-level map and only have 1 copy for the value?
>
> Thanks.
>
> X. F. Li
>