mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 03:52:15 +00:00
Merge pull request #49051 from nickitat/adapt_for_prefetch_read_pool
Adapt marks count for prefetch read pool
This commit is contained in:
commit
7f6488cf37
@ -297,29 +297,10 @@ MergeTreeReadTaskPtr MergeTreePrefetchedReadPool::getTask(size_t thread)
|
|||||||
|
|
||||||
size_t MergeTreePrefetchedReadPool::getApproxSizeOfGranule(const IMergeTreeDataPart & part) const
|
size_t MergeTreePrefetchedReadPool::getApproxSizeOfGranule(const IMergeTreeDataPart & part) const
|
||||||
{
|
{
|
||||||
const auto & columns = part.getColumns();
|
ColumnSize columns_size{};
|
||||||
auto all_columns_are_fixed_size = columns.end() == std::find_if(
|
for (const auto & col_name : column_names)
|
||||||
columns.begin(), columns.end(),
|
columns_size.add(part.getColumnSize(col_name));
|
||||||
[](const auto & col){ return col.type->haveMaximumSizeOfValue() == false; });
|
return columns_size.data_compressed / part.getMarksCount();
|
||||||
|
|
||||||
if (all_columns_are_fixed_size)
|
|
||||||
{
|
|
||||||
size_t approx_size = 0;
|
|
||||||
for (const auto & col : columns)
|
|
||||||
approx_size += col.type->getMaximumSizeOfValueInMemory() * fixed_index_granularity;
|
|
||||||
|
|
||||||
if (!index_granularity_bytes)
|
|
||||||
return approx_size;
|
|
||||||
|
|
||||||
return std::min(index_granularity_bytes, approx_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t approx_size = static_cast<size_t>(std::round(static_cast<double>(part.getBytesOnDisk()) / part.getMarksCount()));
|
|
||||||
|
|
||||||
if (!index_granularity_bytes)
|
|
||||||
return approx_size;
|
|
||||||
|
|
||||||
return std::min(index_granularity_bytes, approx_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MergeTreePrefetchedReadPool::PartsInfos MergeTreePrefetchedReadPool::getPartsInfos(
|
MergeTreePrefetchedReadPool::PartsInfos MergeTreePrefetchedReadPool::getPartsInfos(
|
||||||
|
Loading…
Reference in New Issue
Block a user