Files
sentiment-engine/prod/clickhouse/prodgreen/02_create_trade_reconstruction.sql

15 lines
418 B
MySQL
Raw Normal View History

CREATE TABLE IF NOT EXISTS dolphin_prodgreen.trade_reconstruction
(
`ts` DateTime64(6, 'UTC'),
`ts_day` Date MATERIALIZED toDate(ts),
`trade_id` String,
`event_type` LowCardinality(String),
`event_id` String,
`payload_json` String
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(ts)
ORDER BY (ts_day, trade_id, event_type, event_id)
TTL ts_day + toIntervalDay(180)
SETTINGS index_granularity = 8192