Does the same partition key in different cassandra tables add up to cell theoretical limit?
Asked Answered
D

1

6

It is known that a Cassandra partition has a theoretical limit of 2 billion cells. But how does that work in a situation like this one below:

create table table1 (
    some_id int PRIMARY KEY,
    some_name text
);

create table table2 (
    other_id int PRIMARY KEY,
    other_name text
);

Assume we have 1 billion cells in partition (some_id = 1) on table1. If we had another 1 billion cells in partition (other_id = 1) on table2, would those add up to the 2 billion theoretical limit?

In other words, are equal partition keys in different tables stored together?

Devlen answered 18/4, 2016 at 17:44 Comment(5)
Possible duplicate of Cassandra has a limit of 2 billion cells per partition, but what's a partition?Hyman
Thanks RussS for your comment. It is slightly different from that post but this difference is interesting for me. Every post I found stated what is a partition key and how they are distributed throughout the cluster but none of them ever brought the info requested in my post (I guess). At least it still concerns me.Devlen
Different tables have different partitions even with the same tokenHyman
That's it RussS, thanks! It was not clear for me until you answered (even after reading the post you suggested).Devlen
If they were the same "partition" then the partition would have heterogeneous composition (if the table had a different structure). The storage under the hood is also segregated based on table. Eh I'll just format all this into another answer.Hyman
H
7

Different tables have different partitions. This makes the structure of any particular partition homogenous (it will always follow the proscribed schema of a single table) which allows for optimizations.

If you look at the storage engine under the hood you'll see that every table even has it's own directory structure making it clear that a partition from one table will never interact with the partition of another. (see /var/lib/cassandra/)

Hyman answered 19/4, 2016 at 0:25 Comment(2)
For a single table, if I am using singe-node cassandra cluster, does adding 1 billion cells in partitionkey=a and 1 billion cells in partitionKey=b result in cassandra hitting that limit?Barrens
The theoretical limit is per partition not per cluster or nodeHyman

© 2022 - 2024 — McMap. All rights reserved.