и 20.8?
Таблица такая
CREATE TABLE default.events
(
`event_id` String CODEC (ZSTD(1)),
`event_time` DateTime CODEC (ZSTD(1)),
`event_machine` String CODEC (ZSTD(1))
)ENGINE = MergeTree
PARTITION BY toYYYYMMDD(event_time)
ORDER BY (event_machine, cityHash64(event_id))
SAMPLE BY cityHash64(event_id) SETTINGS index_granularity = 8192
Запрос выглядит так
SELECT count()
FROM events
SAMPLE 2 / 100
WHERE ((event_time >= toDateTime('2021-02-17 11:13:40')) AND (event_time <= toDateTime('2021-02-20 11:13:40'))) AND (event_machine IN ('host_211233956'))
в 20.3.21.2
[sv-marmoset327] 2021.02.22 13:36:14.577924 [ 6779 ] {d1983a8d-6241-41ed-8743-8408f949fb4f} <Debug> default.events (SelectExecutor): Selected 7 parts by date, 7 parts by key, 16 marks to read from 12 ranges
[sv-marmoset327] 2021.02.22 13:36:14.584035 [ 6779 ] {d1983a8d-6241-41ed-8743-8408f949fb4f} <Information> executeQuery: Read 131072 rows, 9.88 MiB in 0.008 sec., 16568152 rows/sec., 1.22 GiB/sec.
[sv-marmoset327] 2021.02.22 13:36:14.584071 [ 6779 ] {d1983a8d-6241-41ed-8743-8408f949fb4f} <Debug> MemoryTracker: Peak memory usage (for query): 4.11 MiB.
1 rows in set. Elapsed: 0.009 sec. Processed 131.07 thousand rows, 10.36 MB (14.26 million rows/s., 1.13 GB/s.)
в 20.8.13.15 и в последней stable(21.2.4.6)
[sv-marmoset327] 2021.02.22 13:37:44.404006 [ 7237 ] {f2619ae3-9e88-44e7-bb07-9c8b8123e393} <Debug> default.events (SelectExecutor): Selected 7 parts by date, 7 parts by key, 127 marks by primary key, 127 marks to read from 7 ranges
[sv-marmoset327] 2021.02.22 13:37:44.437560 [ 7237 ] {f2619ae3-9e88-44e7-bb07-9c8b8123e393} <Information> executeQuery: Read 1040384 rows, 75.78 MiB in 0.035525436 sec., 29285608 rows/sec., 2.08 GiB/sec.
[sv-marmoset327] 2021.02.22 13:37:44.437602 [ 7237 ] {f2619ae3-9e88-44e7-bb07-9c8b8123e393} <Debug> MemoryTracker: Peak memory usage (for query): 17.22 MiB.
1 rows in set. Elapsed: 0.036 sec. Processed 1.04 million rows, 79.46 MB (28.54 million rows/s., 2.18 GB/s.)
такое ошущение что семплинг не работает
а что если event_machine IN (select 'host_211233956')
Обсуждают сегодня