官术网_书友最值得收藏!

Structuring of tables

Cassandra structures tables in rows and columns, just like a relational database. Also like a relational database, the columns available to a table are defined in advance. New columns cannot be added on the fly when inserting data, although it's possible to update an existing table's schema.

Every table defines one or more columns to act as the primary key; each row is uniquely identified by the value(s) in its primary key column(s), and those columns cannot be left blank in any row. Cassandra does not offer auto-incrementing primary keys; each row, when created, must be explicitly assigned a primary key by the client. One good way to structure the primary key is to use a natural key, which is a value that is fundamentally unique for each row you want to store. That's what we do in the users table by making username, a naturally unique identifier, the primary key.

Before we continue, I should emphasize the importance of using the latest version of Cassandra. Cassandra and CQL have changed substantially over the past few years, and the current CQL version 3.4 is not backward compatible with older versions of the language. The examples in this book target the latest Cassandra version (at the time of writing, 3.0.9); make sure you're running this version or a newer one.

主站蜘蛛池模板: 贡山| 土默特右旗| 大名县| 棋牌| 日照市| 新竹市| 都兰县| 温宿县| 重庆市| 六盘水市| 鹰潭市| 稷山县| 郸城县| 常州市| 偃师市| 阿巴嘎旗| 商都县| 铜梁县| 建始县| 邵阳市| 柳林县| 历史| 伽师县| 栖霞市| 卓资县| 长泰县| 久治县| 巩义市| 聂荣县| 黄浦区| 营山县| 锡林浩特市| 祁阳县| 双柏县| 大同市| 马鞍山市| 兴仁县| 张家川| 土默特左旗| 桃江县| 东丽区|