Cassandra PK not unique (error on Baeldung website?)

Viewed 60

I'm learning about Cassandra/NoSQL and I'm referring concretely to this page:

https://www.baeldung.com/cassandra-keys

4.1 Partition keys chapter

defines app_name as the PK (partition key), and directly below they show some table data having 2x 'app1' as the app_name...

Which shouldn't be possible, right?

Chapters 4.2 and 4.3 show again problematic data / key constellations, having composite PKs and again violating the uniqueness...

Are the examples crap? Or am I not understanding something correctly?

Coming from relational DBs and then reading this stuff confuses...

1 Answers

Yes. That’re incorrect examples. Examples 4.1 and 4.2 will only work if you add additional field(s) as clustering columns - for example id or timestamp.

I recommend to grab the “Cassandra: The definitive guide, 3rd edition” - it should be still freely available on Datastax site

Related