mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
MergeTreePrefetchedReadPool disable for LIMIT only queries
This commit is contained in:
parent
66d2db5283
commit
b5997e6a96
@ -2501,7 +2501,12 @@ void InterpreterSelectQuery::executeFetchColumns(QueryProcessingStage::Enum proc
|
||||
max_block_size = std::max<UInt64>(1, max_block_limited);
|
||||
max_threads_execute_query = max_streams = 1;
|
||||
}
|
||||
if (max_block_limited < local_limits.local_limits.size_limits.max_rows)
|
||||
if (local_limits.local_limits.size_limits.max_rows != 0 &&
|
||||
max_block_limited < local_limits.local_limits.size_limits.max_rows)
|
||||
{
|
||||
query_info.limit = max_block_limited;
|
||||
}
|
||||
else
|
||||
{
|
||||
query_info.limit = max_block_limited;
|
||||
}
|
||||
|
@ -645,7 +645,12 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres
|
||||
max_threads_execute_query = 1;
|
||||
}
|
||||
|
||||
if (max_block_size_limited < select_query_info.local_storage_limits.local_limits.size_limits.max_rows)
|
||||
if (select_query_info.local_storage_limits.local_limits.size_limits.max_rows != 0 &&
|
||||
max_block_size_limited < select_query_info.local_storage_limits.local_limits.size_limits.max_rows)
|
||||
{
|
||||
table_expression_query_info.limit = max_block_size_limited;
|
||||
}
|
||||
else
|
||||
{
|
||||
table_expression_query_info.limit = max_block_size_limited;
|
||||
}
|
||||
|
@ -418,7 +418,13 @@ Pipe ReadFromMergeTree::readFromPool(
|
||||
&& settings.allow_prefetched_read_pool_for_local_filesystem
|
||||
&& MergeTreePrefetchedReadPool::checkReadMethodAllowed(reader_settings.read_settings.local_fs_method);
|
||||
|
||||
if (allow_prefetched_remote || allow_prefetched_local)
|
||||
/** Do not use prefetched read pool if query is trivial limit query.
|
||||
* Because time spend during filling per thread tasks can be greater than whole query
|
||||
* execution for big tables with small limit.
|
||||
*/
|
||||
bool use_prefetched_read_pool = query_info.limit != 0 && (allow_prefetched_remote || allow_prefetched_local);
|
||||
|
||||
if (use_prefetched_read_pool)
|
||||
{
|
||||
pool = std::make_shared<MergeTreePrefetchedReadPool>(
|
||||
std::move(parts_with_range),
|
||||
|
Loading…
Reference in New Issue
Block a user