- 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.
推薦閱讀
- Visualforce Development Cookbook(Second Edition)
- 工業(yè)機(jī)器人技術(shù)及應(yīng)用
- 計算機(jī)應(yīng)用基礎(chǔ)·基礎(chǔ)模塊
- 走入IBM小型機(jī)世界
- 影視后期制作(Avid Media Composer 5.0)
- 機(jī)器人智能運動規(guī)劃技術(shù)
- Learning Apache Cassandra(Second Edition)
- Google App Inventor
- Docker Quick Start Guide
- Moodle Course Design Best Practices
- Docker on Amazon Web Services
- 多媒體制作與應(yīng)用
- Pentaho Analytics for MongoDB
- 精通LabVIEW程序設(shè)計
- 工業(yè)機(jī)器人實操進(jìn)階手冊