0

CQL実行[クラスタリングキーインデックスを使用すると仮定すると、すぐに戻ります]:

cqlsh:stats> select count(*) from events where month='2015-04' and day = '2015-04-02';

 count
-------
  5447

Presto 実行 [約 8 秒かかります]:

presto:default> select count(*) as c from cassandra.stats.events where month = '2015-04' and day = timestamp '2015-04-02';
  c   
------
 5447 
(1 row)

Query 20150228_171912_00102_cxzfb, FINISHED, 1 node
Splits: 2 total, 2 done (100.00%)
0:08 [147K rows, 144KB] [17.6K rows/s, 17.2KB/s]

cassandra 自体が同じクエリに対して 5447 行しか応答しないのに、なぜ presto は 147K 行を処理する必要があるのでしょうか [select * も試しました]。

presto がクラスタリング キーの最適化を使用できないのはなぜですか?

タイムスタンプ、日付、さまざまな形式の日付など、考えられるすべての値を試しました。フェッチされる行数への影響は確認できません。

CF 参照:

CREATE TABLE events (
  month text,
  day timestamp,
  test_data text,
  some_random_column text,
  event_time timestamp,
  PRIMARY KEY (month, day, event_time)
)  WITH comment='Test Data'
AND read_repair_chance = 1.0;

Dainの回答に応じて、event_timestampも制約として追加しました

presto:default> select count(*) from cassandra.stats.events where month = '2015-04' and day = timestamp '2015-04-02 00:00:00+0000' and event_time = timestamp '2015-04-02 00:00:34+0000';
 _col0 
-------
     1 
(1 row)

Query 20150301_071417_00009_cxzfb, FINISHED, 1 node
Splits: 2 total, 2 done (100.00%)
0:07 [147K rows, 144KB] [21.3K rows/s, 20.8KB/s]
4

1 に答える 1