我在Cassandra数据库中排序数据遇到了问题。这是我的表结构:
当我运行这个查询时,我得到以下信息: 查询:
这个查询可以不排序返回数据:
CREATE TABLE posts (
id uuid,
created_at timestamp,
comment_enabled boolean,
content text,
enabled boolean,
meta map<text, text>,
post_type tinyint,
summary text,
title text,
updated_at timestamp,
url text,
user_id uuid,
PRIMARY KEY (id, created_at)
) WITH CLUSTERING ORDER BY (created_at DESC)
当我运行这个查询时,我得到以下信息: 查询:
select * from posts order by created_at desc;
消息:
ORDER BY is only supported when the partition key is restricted by an EQ or an IN.
这个查询可以不排序返回数据:
select * from posts