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

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.

主站蜘蛛池模板: 蓬莱市| 桐柏县| 花莲市| 福鼎市| 兴和县| 九寨沟县| 太白县| 莒南县| 玉门市| 鄄城县| 双流县| 太保市| 东兰县| 威海市| 民乐县| 泰来县| 西林县| 泸西县| 天长市| 云南省| 克拉玛依市| 盈江县| 淳安县| 波密县| 镇安县| 交口县| 石阡县| 西乌| 石屏县| 乐业县| 罗源县| 平邑县| 呼玛县| 娄烦县| 太湖县| 永和县| 枣强县| 阿图什市| 永胜县| 大邑县| 桐庐县|