是的,你可以在select語句中使用整數時間戳。
[email protected]:testkeyspace> CREATE TABLE test (key int, ts timestamp, v int, PRIMARY KEY (key, ts));
[email protected]:testkeyspace> INSERT INTO test (key, ts, v) VALUES (0, 1434741481000, 0);
[email protected]:testkeyspace> INSERT INTO test (key, ts, v) VALUES (0, 1434741481001, 1);
[email protected]:testkeyspace> INSERT INTO test (key, ts, v) VALUES (0, 1434741481002, 2);
[email protected]:testkeyspace> SELECT ts, v FROM test WHERE key = 0;
ts | v
--------------------------+---
2015-06-19 14:18:01-0500 | 0
2015-06-19 14:18:01-0500 | 1
2015-06-19 14:18:01-0500 | 2
(3 rows)
[email protected]:testkeyspace> SELECT ts, v FROM test WHERE key=0 AND ts >= 1434741481001;
ts | v
--------------------------+---
2015-06-19 14:18:01-0500 | 1
2015-06-19 14:18:01-0500 | 2
(2 rows)
你在失敗的「嘗試這麼做」中看到了什麼? –