dbms: fixed little error [#METR-16457].

This commit is contained in:
Alexey Milovidov 2015-10-08 23:01:09 +03:00
parent e118d055da
commit 0a7b4dd536

View File

@ -389,6 +389,10 @@ BlockInputStreams MergeTreeDataSelectExecutor::spreadMarkRangesAmongThreads(
if (sum_marks > 0 && settings.merge_tree_uniform_read_distribution == 1)
{
/// Уменьшим количество потоков, если данных мало.
if (sum_marks < threads * min_marks_for_concurrent_read && parts.size() < threads)
threads = std::max((sum_marks + min_marks_for_concurrent_read - 1) / min_marks_for_concurrent_read, parts.size());
MergeTreeReadPoolPtr pool = std::make_shared<MergeTreeReadPool>(
threads, sum_marks, min_marks_for_concurrent_read, parts, data, prewhere_actions, prewhere_column, true,
column_names);