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

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.

主站蜘蛛池模板: 益阳市| 丽水市| 凭祥市| 定州市| 枝江市| 三江| 杨浦区| 凭祥市| 平塘县| 客服| 马龙县| 青龙| 依安县| 泸定县| 巴林左旗| 贵港市| 南江县| 铅山县| 蒲城县| 嘉义县| 沙雅县| 兴仁县| 阜南县| 建昌县| 许昌县| 栾川县| 平原县| 汤原县| 韩城市| 兰溪市| 澎湖县| 安福县| 全州县| 青州市| 二连浩特市| 化隆| 巫溪县| 余姚市| 镇坪县| 鞍山市| 湛江市|