Why many refer to Cassandra as a Column oriented database?

后端 未结 7 1032
终归单人心
终归单人心 2020-12-07 10:10

Reading several papers and documents on internet, I found many contradictory information about the Cassandra data model. There are many which identify it as a column oriente

7条回答
  •  清歌不尽
    2020-12-07 10:34

    Yes, the "column-oriented" terminology is a bit confusing.

    The model in Cassandra is that rows contain columns. To access the smallest unit of data (a column) you have to specify first the row name (key), then the column name.

    So in a columnfamily called Fruit you could have a structure like the following example (with 2 rows), where the fruit types are the row keys, and the columns each have a name and value.

    apple -> colour  weight  price variety
             "red"   100     40    "Cox"
    
    orange -> colour    weight  price  origin
              "orange"  120     50     "Spain"
    

    One difference from a table-based relational database is that one can omit columns (orange has no variety), or add arbitrary columns (orange has origin) at any time. You can still imagine the data above as a table, albeit a sparse one where many values might be empty.

    However, a "column-oriented" model can also be used for lists and time series, where every column name is unique (and here we have just one row, but we could have thousands or millions of columns):

    temperature ->  2012-09-01  2012-09-02  2012-09-03 ...
                    40          41          39         ...
    

    which is quite different from a relational model, where one would have to model the entries of a time series as rows not columns. This type of usage is often referred to as "wide rows".

提交回复
热议问题