2016-11-07 205 views
0

在卡桑德拉數據庫我嘗試使用標記功能日期類型的分區鍵列上的範圍查詢,但我得到不正確的結果。我打算在2016-09-09之後獲得記錄,但我也獲得了2016-09-07的記錄。cassandra分區鍵上的令牌如何工作?

卡桑德拉版本:2.1.8 CQL版本:3.0

下面請參閱我的查詢,讓我知道如果我做錯什麼

[email protected]:mydb> select updated_on_day,updated_on from sample_data where token(updated_on_day) > token('2016-09-09') and token(updated_on_day) < token('2016-11-11') limit 10; 

updated_on_day   | updated_on 
--------------------------+-------------------------- 
2016-09-14 00:00:00+0530 | 2016-09-14 11:53:03+0530 
2016-09-14 00:00:00+0530 | 2016-09-14 14:26:58+0530 
2016-09-14 00:00:00+0530 | 2016-09-14 15:30:48+0530 
2016-09-14 00:00:00+0530 | 2016-09-14 16:01:56+0530 
2016-09-07 00:00:00+0530 | 2016-09-07 12:36:36+0530 
+1

閱讀此https://docs.datastax.com/en/cql/3.1/cql/cql_using/paging_c.html –

+0

爲什麼不使用timeuuid? – questionare

+0

謝謝@AshrafulIslam該鏈接解釋了這一切。 –

回答

0

當然,你的分區是由下詔令牌,並且除非使用保留分區密鑰的原始字節順序的ByteOrderedPartitioner,否則它們的順序可以是隨機的。

Here是我最近對類似問題的回答。