Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

guruprasadb avatar image
guruprasadb asked Erick Ramirez edited

Will the data in two tables be in different physical partitions if they have the same partition key?

[FOLLOW UP QUESTION TO #10921]

If I have tables with the same partition key, will the data be in different physical partitions for Table2 and Table3 in such a scenario? Or if it maps to same partition number how will cassandra internally distinguish between the two tables?

partitioner
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

I'm not sure what you mean by "different physical partitions" but I'll try my best to answer your question.

The partitions for 2 tables have no relation to each other regardless of whether they have the same partition key. When you read or write to a table, you are operating on a distinct, specific table in the database.

For example, these 2 write requests will write to 2 different tables even if their partition keys are identical:

INSERT INTO table2 (enterprise_id, ...) VALUES ('abc123', ...)
INSERT INTO table3 (enterprise_id, ...) VALUES ('abc123', ...)

The first query is writing to table2 which is a completely different table to table3 in the second query. The data is stored in different tables and one simply has nothing to do with the other. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.