mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Fix parallel_view_processing with optimize_trivial_insert_select=1
This commit is contained in:
parent
4ae7db8369
commit
dd3515da98
@ -463,9 +463,20 @@ BlockIO InterpreterInsertQuery::execute()
|
||||
|
||||
pipeline.addChains(std::move(out_chains));
|
||||
|
||||
/// Don't use more threads for insert then for select to reduce memory consumption.
|
||||
if (!settings.parallel_view_processing && pipeline.getNumThreads() > num_select_threads)
|
||||
pipeline.setMaxThreads(num_select_threads);
|
||||
if (!settings.parallel_view_processing)
|
||||
{
|
||||
/// Don't use more threads for INSERT than for SELECT to reduce memory consumption.
|
||||
if (pipeline.getNumThreads() > num_select_threads)
|
||||
pipeline.setMaxThreads(num_select_threads);
|
||||
}
|
||||
else if (pipeline.getNumThreads() < settings.max_threads)
|
||||
{
|
||||
/// It is possible for query to have max_threads=1, due to optimize_trivial_insert_select,
|
||||
/// however in case of parallel_view_processing and multiple views, views can still be processed in parallel.
|
||||
///
|
||||
/// Note, number of threads will be limited by buildPushingToViewsChain() to max_threads.
|
||||
pipeline.setMaxThreads(settings.max_threads);
|
||||
}
|
||||
|
||||
pipeline.setSinks([&](const Block & cur_header, QueryPipelineBuilder::StreamType) -> ProcessorPtr
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user