Do not reserve extra threads after max threads optimization for simple queries

Before this patch pipeline.setMaxThreads() was called with 0 (since
streams.size() == 0, while pipes.size() == 1), which leads that
pipeline.getMaxThreads() returns max_streams.

While this threads were not used, they were reserved, which should not
happens either.
This commit is contained in:
Azat Khuzhin 2020-05-21 21:30:35 +03:00
parent 36c7a486a1
commit d4804e070f

View File

@ -1533,7 +1533,7 @@ void InterpreterSelectQuery::executeFetchColumns(
if constexpr (pipeline_with_processors)
{
if (streams.size() == 1 || pipes.size() == 1)
pipeline.setMaxThreads(streams.size());
pipeline.setMaxThreads(1);
/// Unify streams. They must have same headers.
if (streams.size() > 1)