- Learning Apache Cassandra(Second Edition)
- Sandeep Yarabarla
- 111字
- 2021-07-03 00:19:35
Composite partition key with multiple clustering columns
It is also possible to declare a table that has both a composite partition key as well as multiple clustering columns. Suppose we wish to model a status update replies table to be clustered by the reply date first and then the reply time; we would have a table like this:
CREATE TABLE "status_update_replies" (
"status_update_username" text,
"status_update_id" timeuuid,
"status_date" date,
"status_time" time,
"id" timeuuid,
"author_username" text,
"body" text,
PRIMARY KEY (
("status_update_username", "status_update_id"),
"status_date", "status_time", "id"
)
);
In the preceding table, the partition key is a combination of status_update_username and status_update_id.
The replies are clustered by status_date, status_time and id.
推薦閱讀
- PPT,要你好看
- Java編程全能詞典
- Mastering Spark for Data Science
- 條碼技術(shù)及應(yīng)用
- Hands-On Machine Learning with TensorFlow.js
- Security Automation with Ansible 2
- 傳感器技術(shù)應(yīng)用
- AutoCAD 2012中文版繪圖設(shè)計高手速成
- C語言寶典
- 大數(shù)據(jù)驅(qū)動的設(shè)備健康預測及維護決策優(yōu)化
- Windows安全指南
- 21天學通Linux嵌入式開發(fā)
- JRuby語言實戰(zhàn)技術(shù)
- Puppet 3 Beginner’s Guide
- 計算機應(yīng)用基礎(chǔ)實訓(職業(yè)模塊)