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

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.

主站蜘蛛池模板: 偃师市| 盐源县| 留坝县| 贵阳市| 武鸣县| 瓦房店市| 平远县| 竹山县| 远安县| 海林市| 长乐市| 长丰县| 乌兰浩特市| 洛扎县| 潢川县| 永福县| 闽侯县| 新河县| 彭山县| 庆城县| 台前县| 磐石市| 海口市| 汤阴县| 收藏| 汝州市| 莱芜市| 海安县| 墨脱县| 屏南县| 泸定县| 绥化市| 铜陵市| 襄樊市| 万安县| 福贡县| 山东省| 札达县| 红安县| 宁蒗| 潼关县|