|
樓主 |
發表於 15-3-28 21:03
|
顯示全部樓層
更新一下#18的後續,
這個Cassandra Server我一直開著,到今天已經用了2.2G的空間。(現在都只收tick資料了,所收的商品有WTX,MTX,A50,STW,WTX委賣賣,NIFTY,N225M,和這些期貨商品的指數)
我後來寫了一個C的小程式,能去撈出只定商品指定日期區間,以日期排序後的tick,以台指為範例,20141209~20150327,我共存了156萬筆tick,把他們撈出來要花1020秒。
query語法為:'SELECT * from test1.tqdata6 where symbol='WTX' and datetime>='2014-01-01' and datetime<'2015-03-28' order by datetime
每個分頁4萬筆,總共51頁。
C的撈取tick的程式如附件。schema為:
CREATE TABLE test1.tqdata6 (
symbol text,
datetime timestamp,
keyval map<text, double>,
type int,
PRIMARY KEY (symbol, datetime)
) WITH CLUSTERING ORDER BY (datetime ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = ''
AND compaction = {'min_threshold': '4', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
|
|