書名: Learning Apache Cassandra(Second Edition)作者名: Sandeep Yarabarla本章字數(shù): 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.
推薦閱讀
- 現(xiàn)代測控系統(tǒng)典型應(yīng)用實例
- Hands-On Neural Networks with Keras
- CSS全程指南
- 樂高創(chuàng)意機器人教程(中級 下冊 10~16歲) (青少年iCAN+創(chuàng)新創(chuàng)意實踐指導(dǎo)叢書)
- Python Algorithmic Trading Cookbook
- 人工智能與人工生命
- 可編程序控制器應(yīng)用實訓(xùn)(三菱機型)
- R Data Analysis Projects
- 單片機技能與實訓(xùn)
- 大數(shù)據(jù):引爆新的價值點
- 穿越計算機的迷霧
- Data Analysis with R(Second Edition)
- RealFlow流體制作經(jīng)典實例解析
- 暗戰(zhàn)強人:黑客及反黑客工具快速精通
- VMware vSphere 6.5 Cookbook(Third Edition)