What's the difference between creating a table and creating a columnfamily in Cassandra?

前端 未结 5 1461
情书的邮戳
情书的邮戳 2021-02-03 20:59

I need details from both performance and query aspects, I learnt from some site that only a key can be given when using a columnfamily, if so what would you suggest for

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-03 21:16

    Column family are somewhat related to relational database's table, with a distribution differences and maybe even idealistic character.

    Imaging you have a user entity that might contain 15 column, in a relational db you might want to divide the columns into small-related-column-based struct that we all know as Table. In distributed db such as Cassandra you'll be able to concatenate all those tables entry into a single long row, so if you'll use profiler/ db manager you'll see a single table with 15 columns instead of 2/3 tables. Another interesting thing is that every column family is written to different nodes, maybe on different cluster and be recognized by the row key, meaning that you'll have a single key to all the columns family and won't need to maintain a PK or FK for every table and maintain the relationships between them with 1-1, 1-n, n-n relations. Easy!

提交回复
热议问题