запросы where date_utc>= и подобные 
                  
                  
                  
                  
                  
                  CREATE TABLE mego_prod_logs.logs_local
                  
                  
                  (
                  
                  
                  
                  
                  
                      `date_utc` DateTime64(7,
                  
                  
                   'UTC'),
                  
                  
                  
                  
                  
                      `message` String,
                  
                  
                  
                  
                  
                     )
                  
                  
                  ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/logs/logs_local',
                  
                  
                   '{replica}')
                  
                  
                  PARTITION BY toYYYYMMDD(date_utc)
                  
                  
                  ORDER BY (date_utс)
                  
                  
                  TTL toDateTime(date_utc) TO VOLUME 'ttlhot',
                  
                  
                   toDateTime(date_utc) + toIntervalMonth(3) TO VOLUME 'ttlcold',
                  
                  
                   toDateTime(date_utc) + toIntervalMonth(15) TO VOLUME 'ttlarchive'
                  
                  
                  SETTINGS storage_policy = 'ttl',
                  
                  
                   index_granularity = 8192;
                  
                  
                  
                  
                  
                  ИЛи изза того что есть orderby не надо?
                  
                  
                
order by это и есть индекс, в КХ дополнительные индексы крайне редко нужны
Обсуждают сегодня