1
CREATE TABLE notifications (
id uuid PRIMARY KEY,
user_id bigint,
received_datetime timestamp,
);
cqlsh:
select count(*)
from notifications
where received_datetime >='2016-10-11 00:00:00'
and received_datetime >='2016-10-18 00:00:00'
ALLOW FILTERING;
錯誤了: -
InvalidRequest: Error from server: code=2200 [Invalid query] message="More than one restriction was found for the start bound on received_datetime"
我錯過了這一點感謝。 –
您在上面使用ALLOW FILTERING進行的查詢是Cassandra中的反模式。這將導致整個集羣的分散收集操作,這將非常緩慢,並且很可能超時並且有任何合理的大量數據。你應該改變你的表結構來滿足你所要求的查詢。這意味着要設置一個不同的分區和主鍵來回答這個查詢,除非你知道id,在這種情況下,你可以將received_datetime作爲一個集羣列並對其執行範圍查詢。 – bechbd