- Learning Apache Cassandra(Second Edition)
- Sandeep Yarabarla
- 213字
- 2021-07-03 00:19:36
Defining static columns
To see how static columns work, we'll create a new table called users_with_status_updates. Our goal for this table is to contain both user profiles and users' status updates; however, we only want one copy of a user profile even though each user might have many status updates. To accomplish this, we'll add all of the columns from both users and user_status_updates to our new table, but we'll declare the user profile columns as STATIC:
CREATE TABLE "users_with_status_updates" (
"username" text,
"id" timeuuid,
"email" text STATIC,
"encrypted_password" blob STATIC,
"body" text,
PRIMARY KEY ("username", "id")
);
Since the email and encrypted_password columns are properties of a user and not of a specific status update, we declare them STATIC. Any column that is declared STATIC has one value per partition key. In other words, there will be exactly one email value associated with a given username in our table.
The goal of static columns is to allow rows that share a partition key value to share other data as well. For this to be useful, there must be multiple rows per partition key, which is another way of saying that there must be at least one clustering column. It's illegal to declare a static column in a table with no clustering columns.
- Ansible Configuration Management
- Visualforce Development Cookbook(Second Edition)
- Windows程序設計與架構
- CentOS 8 Essentials
- 完全掌握AutoCAD 2008中文版:機械篇
- Word 2007,Excel 2007辦公應用融會貫通
- Pentaho Analytics for MongoDB
- 人工智能技術入門
- R Data Analysis Projects
- 工業自動化技術實訓指導
- ZigBee無線通信技術應用開發
- 玩機器人 學單片機
- Data Analysis with R(Second Edition)
- 西門子S7-1200/1500 PLC從入門到精通
- 精通ROS機器人編程(原書第2版)