Column-family concept and data model

前端 未结 3 1212
迷失自我
迷失自我 2020-12-30 23:27

I\'m investigating the different types of NoSQL database types and I\'m trying to wrap my head around the data model of column-family stores, such as Bigtable, HBase and Cas

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 23:54

    As per my understanding, Cassandra ColumnFamily is not a collection of rows, rather it is cluster of columns. Column are clustered together based on clustering key. for example, lets consider below columnfamily:

    CREATE TABLE store (
      enrollmentId int,
      roleId int,
      name text,
      age int,
      occupation text,
      resume blob,
      PRIMARY KEY ((enrollmentId, roleId), name)
    ) ;
    
    
    INSERT INTO store (enrollmentid, roleid, name, age, occupation, resume)
    values (10293483, 01, 'John Smith', 26, 'Teacher', 0x7b22494d4549);
    

    Fetched inserted above details by using cassandra-cli, it is pretty well clustered based on clustering key, in this example "name = John Smith" is clustering key.

    RowKey: 10293483:1
    => (name=John Smith:, value=, timestamp=1415104618399000)
    => (name=John Smith:age, value=0000001a, timestamp=1415104618399000)
    => (name=John Smith:occupation, value=54656163686572, timestamp=1415104618399000)
    => (name=John Smith:resume, value=7b22494d4549, timestamp=1415104618399000)
    

提交回复
热议问题